-
- Downloads
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 <error27@gmail.com> Signed-off-by:
Nicholas Bellinger <nab@linux-iscsi.org>
Showing
- drivers/target/loopback/tcm_loop.c 2 additions, 2 deletionsdrivers/target/loopback/tcm_loop.c
- drivers/target/target_core_configfs.c 11 additions, 11 deletionsdrivers/target/target_core_configfs.c
- drivers/target/target_core_device.c 1 addition, 1 deletiondrivers/target/target_core_device.c
- drivers/target/target_core_pr.c 3 additions, 3 deletionsdrivers/target/target_core_pr.c
Loading
Please register or sign in to comment