~ubuntu-branches/ubuntu/maverick/mousepad/maverick

« back to all changes in this revision

Viewing changes to debian/patches/10_fix-sigserv-invalid-config.patch

  • Committer: Bazaar Package Importer
  • Author(s): Lionel Le Folgoc
  • Date: 2008-02-13 20:38:01 UTC
  • mfrom: (0.1.3 lenny)
  • Revision ID: james.westby@ubuntu.com-20080213203801-51jpn4343km04ojp
Tags: 0.2.13-2ubuntu1
* Merge from Debian unstable, remaining Ubuntu changes:
  - debian/rules: add the gettext domain in the desktop file
  - debian/control: adhere to DebianMaintainerField
  - debian/patches: keep 10_fix-sigserv-invalid-config.patch.
* debian/patches/series: updated.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
diff -urNad mousepad-0.2.12~/src/main.c mousepad-0.2.12/src/main.c
 
2
--- mousepad-0.2.12~/src/main.c 2007-01-21 15:04:57.000000000 -0400
 
3
+++ mousepad-0.2.12/src/main.c  2007-11-04 21:49:02.000000000 -0400
 
4
@@ -65,22 +65,43 @@
 
5
                return -1;
 
6
        
 
7
        /* version num */
 
8
-       fgets(buf, sizeof(buf), fp);
 
9
+       if (!fgets(buf, sizeof(buf), fp)) return -1;
 
10
        num = g_strsplit(buf, "." , 3);
 
11
        if ((atoi(num[1]) >= 1) && (atoi(num[2]) >= 0)) {
 
12
-               fgets(buf, sizeof(buf), fp);
 
13
-               sd->conf.width = atoi(buf);
 
14
-               fgets(buf, sizeof(buf), fp);
 
15
-               sd->conf.height = atoi(buf);
 
16
-               fgets(buf, sizeof(buf), fp);
 
17
+               if (!fgets(buf, sizeof(buf), fp)) return -1;
 
18
+               if (buf[0] >= '0' && buf[0] <= '9')
 
19
+                       sd->conf.width = atoi(buf);
 
20
+               else
 
21
+                       return -1;
 
22
+
 
23
+               if (!fgets(buf, sizeof(buf), fp)) return -1;
 
24
+               if (buf[0] >= '0' && buf[0] <= '9')
 
25
+                       sd->conf.height = atoi(buf);
 
26
+               else
 
27
+                       return -1;
 
28
+
 
29
+               if (!fgets(buf, sizeof(buf), fp)) return -1;
 
30
                sd->conf.fontname = g_strdup(buf);
 
31
-               fgets(buf, sizeof(buf), fp);
 
32
-               sd->conf.wordwrap = atoi(buf);
 
33
-               fgets(buf, sizeof(buf), fp);
 
34
-               sd->conf.linenumbers = atoi(buf);
 
35
-               fgets(buf, sizeof(buf), fp);
 
36
-               sd->conf.autoindent = atoi(buf);
 
37
-               fgets(buf, sizeof(buf), fp);
 
38
+
 
39
+               if (!fgets(buf, sizeof(buf), fp)) return -1;
 
40
+               if (buf[0] >= '0' && buf[0] <= '1')
 
41
+                       sd->conf.wordwrap = atoi(buf);
 
42
+               else
 
43
+                       return -1;
 
44
+
 
45
+               if (!fgets(buf, sizeof(buf), fp)) return -1;
 
46
+               if (buf[0] >= '0' && buf[0] <= '1')
 
47
+                       sd->conf.linenumbers = atoi(buf);
 
48
+               else
 
49
+                       return -1;
 
50
+
 
51
+               if (!fgets(buf, sizeof(buf), fp)) return -1;
 
52
+               if (buf[0] >= '0' && buf[0] <= '1')
 
53
+                       sd->conf.autoindent = atoi(buf);
 
54
+               else
 
55
+                       return -1;
 
56
+
 
57
+               if (!fgets(buf, sizeof(buf), fp)) return -1;
 
58
                if (strcmp(buf, "0") != 0)
 
59
                        sd->conf.charset = g_strdup(buf);
 
60
        }