]> Zhao Yanbai Git Server - minix.git/commitdiff
cawf: Fix buffer scope 95/2995/1
authorJacob Adams <tookmund@gmail.com>
Sun, 17 May 2015 01:08:33 +0000 (21:08 -0400)
committerLionel Sambuc <lionel@minix3.org>
Mon, 18 May 2015 13:20:36 +0000 (15:20 +0200)
Change-Id: I03f9066c20da142034626b07d0b07c446075b8af

minix/commands/cawf/regexp.c

index 4c95d032e30a9ad80da94de02b37c26194cbab6e..6fc73a81dc07b4cfde648fb8da320929424f9e09 100644 (file)
@@ -1129,14 +1129,14 @@ regexp *r;
 /*
  - regprop - printable representation of opcode
  */
+STATIC unsigned char regprop_buf[50];
 STATIC unsigned char *
 regprop(op)
 unsigned char *op;
 {
        register unsigned char *p;
-       STATIC unsigned char buf[50];
 
-       (void) strcpy(buf, ":");
+       (void) strcpy(regprop_buf, ":");
 
        switch (OP(op)) {
        case BOL:
@@ -1178,7 +1178,7 @@ unsigned char *op;
        case OPEN+7:
        case OPEN+8:
        case OPEN+9:
-               sprintf(buf+strlen(buf), "OPEN%d", OP(op)-OPEN);
+               sprintf(regprop_buf+strlen(regprop_buf), "OPEN%d", OP(op)-OPEN);
                p = NULL;
                break;
        case CLOSE+1:
@@ -1190,7 +1190,7 @@ unsigned char *op;
        case CLOSE+7:
        case CLOSE+8:
        case CLOSE+9:
-               sprintf(buf+strlen(buf), "CLOSE%d", OP(op)-CLOSE);
+               sprintf(regprop_buf+strlen(regprop_buf), "CLOSE%d", OP(op)-CLOSE);
                p = NULL;
                break;
        case STAR:
@@ -1204,8 +1204,8 @@ unsigned char *op;
                break;
        }
        if (p != NULL)
-               (void) strcat(buf, p);
-       return(buf);
+               (void) strcat(regprop_buf, p);
+       return(regprop_buf);
 }
 #endif