added null termination to command. DLW
authorDavid Wasley <dlw@ucbvax.Berkeley.EDU>
Wed, 18 Feb 1981 11:29:10 +0000 (03:29 -0800)
committerDavid Wasley <dlw@ucbvax.Berkeley.EDU>
Wed, 18 Feb 1981 11:29:10 +0000 (03:29 -0800)
SCCS-vsn: usr.bin/f77/libU77/system_.c 1.3

usr/src/usr.bin/f77/libU77/system_.c

index 06008b0..3c8be54 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-char id_system[] = "@(#)system_.c      1.2";
+char id_system[] = "@(#)system_.c      1.3";
  *
  * execute a unix command
  *
  *
  * execute a unix command
  *
@@ -11,14 +11,19 @@ char id_system[] = "@(#)system_.c   1.2";
  */
 
 #include       "../libI77/fiodefs.h"
  */
 
 #include       "../libI77/fiodefs.h"
+#include       "../libI77/f_errno.h"
 
  
 long system_(s, n)
 char *s;
 long n;
 {
 
  
 long system_(s, n)
 char *s;
 long n;
 {
+       char buf[256];
        int i;
 
        int i;
 
+       if (n >= sizeof buf)
+               return(-(long)(errno=F_ERARG));
        for (i = 0; i < MXUNIT; flush(i++)) ;
        for (i = 0; i < MXUNIT; flush(i++)) ;
-       return((long)system(s));
+       g_char(s, n, buf);
+       return((long)system(buf));
 }
 }