From: Shlomi Fish Date: Sat, 4 Apr 2020 17:49:43 +0000 (+0300) Subject: elim -D_FORTIFY_SOURCE warnings. X-Git-Tag: fortune-mod-2.20.0~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=25c5f7c76a77c9ca9ba991c11b8821d1ec42a455;p=fortune-mod elim -D_FORTIFY_SOURCE warnings. --- diff --git a/fortune-mod/fortune/fortune.c b/fortune-mod/fortune/fortune.c index a35156a..80842ab 100644 --- a/fortune-mod/fortune/fortune.c +++ b/fortune-mod/fortune/fortune.c @@ -708,11 +708,8 @@ static int add_file(int percent, register const char *file, const char *dir, fp->fd = fd; fp->percent = percent; - fp->name = do_malloc(strlen(file) + (size_t)1); - strncpy(fp->name, file, strlen(file) + (size_t)1); - - fp->path = do_malloc(strlen(path) + (size_t)1); - strncpy(fp->path, path, strlen(path) + 1UL); + fp->name = strdup(file); + fp->path = strdup(path); // FIXME fp->utf8_charset = FALSE;