Wu Bo
unread,Mar 18, 2020, 9:46:06 PM3/18/20Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Lee Duncan, Chris Leech, open-...@googlegroups.com, Mike Christie, mingfangsen
From: Wu Bo <
wub...@huawei.com>
iscsi-iname -p access NULL pointer without give IQN prefix.
# iscsi-iname -p
Segmentation fault
Signed-off-by: Wu Bo <
wub...@huawei.com>
---
utils/iscsi-iname.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/utils/iscsi-iname.c b/utils/iscsi-iname.c
index da850dc..7df7bb0 100644
--- a/utils/iscsi-iname.c
+++ b/utils/iscsi-iname.c
@@ -69,7 +69,7 @@ main(int argc, char *argv[])
exit(0);
} else if ( strcmp(prefix, "-p") == 0 ) {
prefix = argv[2];
- if (strnlen(prefix, PREFIX_MAX_LEN + 1) > PREFIX_MAX_LEN) {
+ if (prefix && (strnlen(prefix, PREFIX_MAX_LEN + 1) >
PREFIX_MAX_LEN)) {
printf("Error: Prefix cannot exceed %d "
"characters.\n", PREFIX_MAX_LEN);
exit(1);
--
2.21.0