From 7b0dc2a317a3d149d396bc48dae7b8e9bf1a1a6b Mon Sep 17 00:00:00 2001 From: LOLi Date: Fri, 24 Mar 2017 02:57:54 +0100 Subject: Fix 'zdb -o' segmentation fault Fix a regression accidentally introduced by OpenZFS 7280 in ed828c0: since whether to accept NULL as a valid first parameter in strchr() is implementation specific we add an additional check to avoid crashing. Reviewed-by: Brian Behlendorf Signed-off-by: loli10K Closes #5917 --- lib/libzpool/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/libzpool/util.c') diff --git a/lib/libzpool/util.c b/lib/libzpool/util.c index 3bdc31722..8e1c104a3 100644 --- a/lib/libzpool/util.c +++ b/lib/libzpool/util.c @@ -182,7 +182,7 @@ set_global_var(char *arg) "little-endian systems\n"); return (ENOTSUP); #endif - if ((varval = strchr(arg, '=')) != NULL) { + if (arg != NULL && (varval = strchr(arg, '=')) != NULL) { *varval = '\0'; varval++; val = strtoull(varval, NULL, 0); -- cgit v1.2.3