From 25c5f7c76a77c9ca9ba991c11b8821d1ec42a455 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Sat, 4 Apr 2020 20:49:43 +0300 Subject: [PATCH] elim -D_FORTIFY_SOURCE warnings. --- fortune-mod/fortune/fortune.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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; -- 2.40.0