diff options
author | Yusuke Endoh <[email protected]> | 2019-10-12 21:10:49 +0900 |
---|---|---|
committer | Yusuke Endoh <[email protected]> | 2019-10-12 21:14:20 +0900 |
commit | cb14c4a535ca95bb87d47be284f447c9325733fd (patch) | |
tree | 8fde516312928c8afdc6a48bbd3d31e2189c3382 /missing/setproctitle.c | |
parent | f4055647115f2003ce614dd16cf68d2933f811fe (diff) |
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.
Diffstat (limited to 'missing/setproctitle.c')
-rw-r--r-- | missing/setproctitle.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/missing/setproctitle.c b/missing/setproctitle.c index 9fceeee52b..811829c060 100644 --- a/missing/setproctitle.c +++ b/missing/setproctitle.c @@ -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 |