Просмотр исходного кода

Fix bad memory access do_script(), introduced when the casting errors were
fixed previously.

Adam Heath лет назад: 25
Родитель
Сommit
d572d93ebd
2 измененных файлов с 10 добавлено и 3 удалено
  1. 5 0
      ChangeLog
  2. 5 3
      main/help.c

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+Mon Apr 23 14:13:48 CDT 2001 Adam Heath <doogie@debian.org>
+
+  * main/help.c: Fix bad memory access do_script(), introduced when the
+    casting errors were fixed previously.
+
 Mon Apr 23 06:27:47 CDT 2001 Adam Heath <doogie@debian.org>
 
   * lib/*.c: Changed 0 to NULL.

+ 5 - 3
main/help.c

@@ -254,18 +254,20 @@ static void setexecute(const char *path, struct stat *stab) {
   ohshite(_("unable to set execute permissions on `%.250s'"),path);
 }
 static int do_script(const char *pkg, const char *scriptname, const char *scriptpath, struct stat *stab, char *const arglist[], const char *desc, const char *name, int warn) {
+  const char *scriptexec;
   int c1, r;
   setexecute(scriptpath,stab);
 
   c1= m_fork();
   if (!c1) {
-    char **narglist;
+    const char **narglist;
     for (r=0; arglist[r]; r++) ;
     narglist=nfmalloc(r*sizeof(char*));
     for (r=1; arglist[r]; r++)
       narglist[r]= arglist[r];
-    narglist[0]= strdup(preexecscript(scriptpath,arglist));
-    execv(narglist[0],narglist);
+    scriptexec= preexecscript(scriptpath,arglist);
+    narglist[0]= scriptexec;
+    execv(scriptexec,arglist);
     ohshite(desc,name);
   }
   script_catchsignals(); /* This does a push_cleanup() */