embryo_cc - fix possible buffer overrun
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Mon, 1 Sep 2014 10:10:48 +0000 (19:10 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Mon, 1 Sep 2014 10:40:46 +0000 (19:40 +0900)
fix CID 1039591

src/bin/embryo/embryo_cc_sc1.c

index 15049f9834b83eb05b785391659980781c4f33d0..aee5abb36a2d7562ffffb43eb756427a1690465a 100644 (file)
@@ -2637,7 +2637,8 @@ doarg(char *name, int ident, int offset, int tags[], int numtags,
    cell                size;
    int                 idxtag[sDIMEN_MAX];
 
-   strcpy(arg->name, name);
+   strncpy(arg->name, name, sizeof(arg->name) - 1);
+   arg->name[sizeof(arg->name) - 1] = 0;
    arg->hasdefault = FALSE;    /* preset (most common case) */
    arg->defvalue.val = 0;      /* clear */
    arg->defvalue_tag = 0;