-
Notifications
You must be signed in to change notification settings - Fork 463
Closed
Description
Hi
I found a potential null pointer dereference. Although it looks improbabl, it is possible.
#if defined sun
str = Util_SafeStrdup(ctime_r(&t, buf, sizeof buf));
#else
str = Util_SafeStrdup(ctime_r(&t, buf)); // step 1: null may be returned if ctime_r fails
#endif
str[strlen(str) - 1] = '\0'; // Remove the trailing '\n'.
return str; // step 2: return the null pointer and dereference it.
According to the linux document, ctime_r may return null if an internal error happens, which makes the null pointer dereference possible.
Although it looks improbable, I suggest to patch it for better stability.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels