From: Denys Vlasenko Date: Tue, 11 Jan 2011 12:07:22 +0000 (+0100) Subject: lsmod: fox unsafe usage of strlen() - 1 X-Git-Tag: 1_19_0~410 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5a163b26451c591187482f99659e5fe639a0616a;p=oweals%2Fbusybox.git lsmod: fox unsafe usage of strlen() - 1 Signed-off-by: Denys Vlasenko --- diff --git a/modutils/lsmod.c b/modutils/lsmod.c index ab7c11f2a..d7e16689b 100644 --- a/modutils/lsmod.c +++ b/modutils/lsmod.c @@ -87,7 +87,8 @@ int lsmod_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) // N.B. token[3] is either '-' (module is not used by others) // or comma-separated list ended by comma // so trimming the trailing char is just what we need! - token[3][strlen(token[3])-1] = '\0'; + if (token[3][0]) + token[3][strlen(token[3]) - 1] = '\0'; # if ENABLE_UNICODE_SUPPORT { uni_stat_t uni_stat;