target/usb-gadget: strlen() doesn't count the terminator

We need to take the terminator into consideration here or the last
character gets silently truncated away later.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
This commit is contained in:
Dan Carpenter 2012-10-02 11:27:14 +03:00 коммит произвёл Nicholas Bellinger
Родитель 8ecf595bc2
Коммит 232ebe34e1
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -1815,7 +1815,7 @@ static ssize_t tcm_usbg_tpg_store_nexus(
ret = tcm_usbg_drop_nexus(tpg);
return (!ret) ? count : ret;
}
if (strlen(page) > USBG_NAMELEN) {
if (strlen(page) >= USBG_NAMELEN) {
pr_err("Emulated NAA Sas Address: %s, exceeds"
" max: %d\n", page, USBG_NAMELEN);
return -EINVAL;