From 321c9ce93e4ea8960cce63d6a1929ef8b791bc45 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Tue, 16 Feb 2021 11:54:56 +1100 Subject: [PATCH] Fix warnings in liblrzip_demo.c --- liblrzip_demo.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/liblrzip_demo.c b/liblrzip_demo.c index e8ead86..053439f 100644 --- a/liblrzip_demo.c +++ b/liblrzip_demo.c @@ -317,16 +317,17 @@ int main(int argc, char *argv[]) if (!lrzip_files_count(lr)) lrzip_file_add(lr, stdin); if (lrzip_filenames_count(lr)) { if (!lrzip_outfilename_get(lr)) { - char buf[4096]; + char *buf; const char *infile; size_t len; infile = lrzip_filenames_get(lr)[0]; len = strlen(infile); + buf = alloca(len + 8); if (!strcmp(infile + len - 4, ".lrz")) - strncat(buf, infile, len - 4); + strcat(buf, infile); else - snprintf(buf, sizeof(buf), "%s.out", infile); + sprintf(buf, "%s.out", infile); lrzip_outfilename_set(lr, buf); } } else if (!lrzip_outfile_get(lr)) lrzip_outfile_set(lr, stdout);