From: Wu Bo <[email protected]>
iscsi-iname -p access NULL pointer without give IQN prefix.
# iscsi-iname -p
Segmentation fault
Signed-off-by: Wu Bo <[email protected]>
---
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
--
You received this message because you are subscribed to the Google Groups
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/open-iscsi/6ba31be9-caa5-2d7f-53f1-180986658ec1%40huawei.com.