From: David du Colombier <0intro@gmail.com> Date: Sat, 13 Jun 2015 19:35:08 +0000 (+0200) Subject: use strncpy instead of strcpy X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=9022221e9db98daedc51e66fe91c503ce39e34da;p=proto%2Flibregexp.git use strncpy instead of strcpy --- diff --git a/regcomp.c b/regcomp.c index d7cd766..d8b0826 100644 --- 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); } diff --git a/regerror.c b/regerror.c index b218da1..c2e1826 100644 --- a/regerror.c +++ b/regerror.c @@ -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));