From: Karel Zak Date: Tue, 31 Jan 2012 13:04:03 +0000 (+0100) Subject: namei: more robust add_it() [coverity scan] X-Git-Tag: v2.21-rc2~58 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=54b6adf344d0cc6bbdc8237198e058f5de9d60d7;p=thirdparty%2Futil-linux.git namei: more robust add_it() [coverity scan] Signed-off-by: Karel Zak --- diff --git a/misc-utils/namei.c b/misc-utils/namei.c index 752c0c183c..3c2e7fc310 100644 --- a/misc-utils/namei.c +++ b/misc-utils/namei.c @@ -134,9 +134,9 @@ add_id(struct idcache **ic, char *name, unsigned long int id, int *width) else *ic = nc; if (w <= 0) - w = strlen(nc->name); - *width = *width < w ? w : *width; + w = nc->name ? strlen(nc->name) : 0; + *width = *width < w ? w : *width; return; }