This is another patch against 2.6.7 + the current Debian patch.  This
one does a couple of minor cleanups to the code that handles filenames
starting with "~username".  First, such names may be greater than 20
characters long, so this code may overflow its buffer.  On Fedora,
they can be 256 characters long.  The patch uses LOGIN_NAME_MAX
instead.  Second, the variable "q" is initialized twice with the same
value, so this patch removes the second initialization.  Finally,
since we already know that q[0] == '~', there is no point in starting
the loop at index 0.  Starting it at index 1 also gets gcc to stop
whining about a possibly negative array index when setting name[n - 1]
to zero.

Regards,
-- 
Jerry James
http://loganjerry.googlepages.com/
diff -dur gcl-2.6.7.ORIG/o/unixfsys.c gcl-2.6.7/o/unixfsys.c
--- gcl-2.6.7.ORIG/o/unixfsys.c	2008-11-04 16:36:47.000000000 -0700
+++ gcl-2.6.7/o/unixfsys.c	2008-11-04 16:46:37.000000000 -0700
@@ -215,7 +215,7 @@
     
 #ifndef NO_PWD_H  
   if(namestring->st.st_self[0]=='~')
-    {char name[20];
+    {char name[LOGIN_NAME_MAX];
      int n;
      char *q = namestring->st.st_self;
 #ifndef __STDC__
@@ -225,8 +225,7 @@
 
      struct passwd *pwent;
      int m=0;
-     q=namestring->st.st_self;
-     for (n=0; n< namestring->st.st_fillp; n++)
+     for (n=1; n< namestring->st.st_fillp; n++)
        if (q[n]=='/') break;
      bcopy(q+1,name,n-1);
      name[n-1]= 0;
_______________________________________________
Gcl-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gcl-devel

Reply via email to