Skip to content

Commit

Permalink
Dont use user supplied progname to remove CWE134 warning
Browse files Browse the repository at this point in the history
  • Loading branch information
vmcj committed Jan 24, 2022
1 parent 18ddf38 commit 02ae652
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/lib.error.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ void vlogmsg(int msglevel, const char *mesg, va_list ap)
progname_escaped = printf_escape(progname);
if ( progname_escaped==NULL ) abort();

bufferlen = strlen(timestring)+strlen(progname_escaped)+strlen(mesg)+20;
bufferlen = strlen(timestring)+strlen(mesg)+20;
buffer = (char *)malloc(bufferlen);
if ( buffer==NULL ) abort();

snprintf(buffer, bufferlen, "[%s] %s[%d]: %s\n",
timestring, progname_escaped, getpid(), mesg);
snprintf(buffer, bufferlen, "[%s] [%d]: %s\n",
timestring, getpid(), mesg);

free(progname_escaped);

Expand Down

0 comments on commit 02ae652

Please sign in to comment.