aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libzpool
diff options
context:
space:
mode:
authorLOLi <[email protected]>2017-03-24 02:57:54 +0100
committerBrian Behlendorf <[email protected]>2017-03-23 18:57:54 -0700
commit7b0dc2a317a3d149d396bc48dae7b8e9bf1a1a6b (patch)
tree6181ac553851b369f74294fece050b1d6656ee4a /lib/libzpool
parent8d703987407acfcbd992ba4a7926f2d76ca3779c (diff)
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 <[email protected]> Signed-off-by: loli10K <[email protected]> Closes #5917
Diffstat (limited to 'lib/libzpool')
-rw-r--r--lib/libzpool/util.c2
1 files changed, 1 insertions, 1 deletions
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);