From: Dan Carpenter Date: Wed, 15 Jun 2011 17:03:05 +0000 (-0700) Subject: target: Fix incorrect strlen() NULL terminator checks X-Git-Tag: v3.0-rc5~38^2~3 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60d645a4e9e7e7ddc20e534fea82aa4e6947f911;p=pandora-kernel.git target: Fix incorrect strlen() NULL terminator checks This patch fixes a number of cases in target core using an incorrectly if (strlen(foo) > SOME_MAX_SIZE) As strlen() returns the number of characters in the string not counting the NULL character at the end. So if you do something like: char buf[10]; if (strlen("0123456789") > 10) return -ETOOLONG; snprintf(buf, 10, "0123456789"); printf("%s\n", buf); then the last "9" gets chopped off and only "012345678" is printed. Plus I threw in one small related cleanup. Signed-off-by: Dan Carpenter Signed-off-by: Nicholas Bellinger --- Reading git-diff-tree failed