]> git.mdlowis.com Git - proto/libregexp.git/commitdiff
use strncpy instead of strcpy
authorDavid du Colombier <0intro@gmail.com>
Sat, 13 Jun 2015 19:35:08 +0000 (21:35 +0200)
committerDavid du Colombier <0intro@gmail.com>
Sat, 13 Jun 2015 19:35:08 +0000 (21:35 +0200)
regcomp.c
regerror.c

index d7cd7667c318ef77d24397542befa3b05053ae7f..d8b082621007d9d97246be365eea9bb20c0dcdab 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -123,7 +123,7 @@ static      void
 cant(char *s)
 {
        char buf[100];
-       strcpy(buf, "can't happen: ");
+       strncpy(buf, "can't happen: ", sizeof(buf));
        strcat(buf, s);
        rcerror(buf);
 }
index b218da156fac296f44b0fb375e433a22fcd2f0f7..c2e1826ba6c04821289aa0a3399ab8ea50a0376b 100644 (file)
@@ -8,7 +8,7 @@ regerror(char *s)
 {
        char buf[132];
 
-       strcpy(buf, "regerror: ");
+       strncpy(buf, "regerror: ", sizeof(buf));
        strcat(buf, s);
        strcat(buf, "\n");
        write(2, buf, strlen(buf));