Package: gcl
Version: 2.6.12-1
Severity: important
Tags: patch

Dear Maintainer,

When using gcl i noticed (DIRECTORY #P"/;rm -rf ~;") did what it says
because the arguments to a popen call weren't quoted. I've included a 
patch which quotes the arguments for all cases of popen. I think it would
be better to rewrite these popen calls to native c code instead.

I haven't reported it upstream yet since account creation takes ages for their
bugtracker.

Kind regards,

Axel

---8<--- popen patch: ---8<---

diff -urN gcl_2.6.12_orig/o/alloc.c gcl-2.6.12/o/alloc.c
--- gcl_2.6.12_orig/o/alloc.c   2014-10-23 23:29:00.000000000 +0200
+++ gcl-2.6.12/o/alloc.c        2015-10-18 11:33:02.509804519 +0200
@@ -1466,7 +1466,7 @@
   if (chdir(P_tmpdir))
     FEerror("Cannot change directory to tmpdir", 0);
   _mcleanup();
-  if (snprintf(b1,sizeof(b1),"gprof %s",kcl_self)<=0)
+  if (snprintf(b1,sizeof(b1),"gprof '%s'",kcl_self)<=0)
     FEerror("Cannot write gprof command line", 0);
   if (!(pp=popen(b1,"r")))
     FEerror("Cannot open gprof pipe", 0);
diff -urN gcl_2.6.12_orig/o/unexec-19.29.c gcl-2.6.12/o/unexec-19.29.c
--- gcl_2.6.12_orig/o/unexec-19.29.c    2014-10-23 23:29:00.000000000 +0200
+++ gcl-2.6.12/o/unexec-19.29.c 2015-10-18 11:31:49.908324174 +0200
@@ -936,7 +936,7 @@
    
 
     /* The use of _execname is incompatible with RISCiX 1.1 */
-    sprintf (command, "nm %s | fgrep mcount", _execname);
+    sprintf (command, "nm '%s' | fgrep mcount", _execname);
 
     if ( (pfile = popen(command, "r")) == NULL)
     {
diff -urN gcl_2.6.12_orig/o/unexec.c gcl-2.6.12/o/unexec.c
--- gcl_2.6.12_orig/o/unexec.c  2014-10-23 23:29:00.000000000 +0200
+++ gcl-2.6.12/o/unexec.c       2015-10-18 11:31:31.883918663 +0200
@@ -937,7 +937,7 @@
    
 
     /* The use of _execname is incompatible with RISCiX 1.1 */
-    sprintf (command, "nm %s | fgrep mcount", _execname);
+    sprintf (command, "nm '%s' | fgrep mcount", _execname);
 
     if ( (pfile = popen(command, "r")) == NULL)
     {
diff -urN gcl_2.6.12_orig/o/unixfsys.c gcl-2.6.12/o/unixfsys.c
--- gcl_2.6.12_orig/o/unixfsys.c        2014-10-23 23:29:00.000000000 +0200
+++ gcl-2.6.12/o/unixfsys.c     2015-10-18 11:30:48.795030882 +0200
@@ -659,7 +659,7 @@
                strcat(filename, "*");
        } else
                coerce_to_filename(vs_base[0], filename);
-       sprintf(command, "ls -d %s 2> /dev/null", filename);
+       sprintf(command, "ls -d '%s' 2> /dev/null", filename);
        fp = popen(command, "r");
        setbuf(fp, iobuffer);
        for (;;) {

---8<--- end of popen patch ---8<---


-- System Information:
Debian Release: 8.2
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages gcl depends on:
ii  debconf            1.5.56
ii  emacs24 [emacsen]  24.4+1-5
ii  gcc                4:4.9.2-2
ii  libc6              2.19-18+deb8u1
ii  libgmp10           2:6.0.0+dfsg-6
ii  libreadline6       6.3-8+b3
ii  libtcl8.6          8.6.2+dfsg-2
ii  libtk8.6           8.6.2-1
ii  libx11-6           2:1.6.2-3
ii  ucf                3.0030

gcl recommends no packages.

Versions of packages gcl suggests:
pn  gcl-doc  <none>

-- debconf information:
  gcl/default_gcl_ansi:
  gcl/default_gcl_prof:

Reply via email to