Skip to content

Commit 05504eb

Browse files
authored
fix: fix possible use of unitialized memory fixes issue #99 (#100)
1 parent 517ea62 commit 05504eb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mylog.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,10 @@ const char *GetExeProgramName()
133133

134134
for (i = 0; i < sizeof(flist) / sizeof(flist[0]); i++)
135135
{
136-
if (readlink(flist[i], path_name, sizeof(path_name)) > 0)
136+
ssize_t len = readlink(flist[i], path_name, sizeof(path_name));
137+
if (len > 0)
137138
{
139+
path_name[len] = '\0';
138140
/* fprintf(stderr, "i=%d pathname=%s\n", i, path_name); */
139141
STRCPY_FIXED(exename, po_basename(path_name));
140142
break;

0 commit comments

Comments
 (0)