The patch below fixes this issue.

--- netkit-ftp-0.17/ftp/main.c  2008-03-21 13:03:32.000000000 +0000
+++ ftp/main.c  2008-03-21 00:49:18.000000000 +0000
@@ -478,10 +478,29 @@
 char **
 makeargv(int *pargc, char **parg)
 {
-   static char *rargv[20];
+        static char **rargv = NULL;
    int rargc = 0;
+        int i = 0, count = 0;
    char **argp;
 
+        /* free previous memory if any. */
+        if ( rargv != NULL ) {
+                free(rargv);
+                rargv = NULL;
+        }
+
+        /* Allocate enough sapce: err on the side of caution */
+        while ( line[i] != '\0' ) {
+                if ( line[i] == ' ' )
+                        count += 1 ;
+                i+= 1;
+        }
+
+        /* allocate memory for $count-sized array of chars */
+        rargv = (char **) malloc( count * sizeof(char*));
+   if (rargv == NULL)
+                fatal("Out of memory");
+
    INTOFF;
    argbuf = obstack_alloc(&mainobstack, strlen(line) + 1);
    INTON;

Steve
-- 
Managed Anti-Spam Service
http://mail-scanning.com/




-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to