File: fdmount.patch

package info (click to toggle)
fdutils 5.3-3
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,004 kB
  • ctags: 621
  • sloc: ansic: 6,098; sh: 2,236; makefile: 279; sed: 4
file content (53 lines) | stat: -rw-r--r-- 1,362 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
--- fdmount.c.old	Wed Jul  1 16:30:27 1998
+++ fdmount.c	Wed Dec  1 16:29:27 1999
@@ -99,10 +99,10 @@
 char *fsnames[7] = {"???","minix", "msdos", "vfat", "ext2","ext","xia"};
 
 void die(const char *text,...) {
-    char buff[80];
+    char *buff;
     va_list p;
     va_start(p,text);
-    vsprintf(buff,text,p);
+    vasprintf(&buff,text,p);
     va_end(p);
     if(use_syslog)
 	syslog(LOG_ERR, "%s: %s\n",curdev,buff);
@@ -112,10 +112,10 @@
 }
 
 void msg(char *text,...) {
-    char buff[80];
+    char *buff;
     va_list p;
     va_start(p,text);
-    vsprintf(buff,text,p);
+    vasprintf(&buff,text,p);
     va_end(p);
     if(!opt_silent) {
 	if(use_syslog)
@@ -126,10 +126,10 @@
 }
 
 void errmsg(char *text,...) {
-    char buff[80];
+    char *buff;
     va_list p;
     va_start(p,text);
-    vsprintf(buff,text,p);
+    vasprintf(&buff,text,p);
     va_end(p);
     if(use_syslog)
 	syslog(LOG_ERR, "%s: %s\n",curdev,buff);
@@ -208,8 +208,9 @@
 	}
   
     /* There is at least one character in canonical[],
-       and the last char in canonical[], *p, is '/'.  */
-    while ((*path != '\0') && (p < canonical + PATH_MAX))
+       and the last char in canonical[], *p, is '/',
+       and we also want to add /0 to end the string.  */
+    while ((*path != '\0') && (p < canonical + PATH_MAX - 2 ))
 	if (*p != '/')
 	    {
 		*++p = *path++;