зеркало из https://github.com/github/ruby.git
missing/setproctitle.c: remove nonsense NULL check
If fmt is NULL, ptitle is uninitialized and used. SETPROCTITLE(3bsd) says "If fmt is NULL, the process title is restored", but looks like the feature is not implemented in missing/setproctitle.c. At least the source code of ruby does not pass NULL to the function. So I assume this function requires non-NULL fmt. This issue was found by Coverity Scan.
This commit is contained in:
Родитель
f405564711
Коммит
cb14c4a535
|
@ -152,10 +152,9 @@ setproctitle(const char *fmt, ...)
|
|||
return;
|
||||
#endif
|
||||
|
||||
/* fmt must be non-NULL */
|
||||
va_start(ap, fmt);
|
||||
if (fmt != NULL) {
|
||||
vsnprintf(ptitle, sizeof(ptitle) , fmt, ap);
|
||||
}
|
||||
vsnprintf(ptitle, sizeof(ptitle), fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
#if SPT_TYPE == SPT_PSTAT
|
||||
|
|
Загрузка…
Ссылка в новой задаче