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 <behlendorf1@llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes #5917
This commit is contained in:
LOLi 2017-03-24 02:57:54 +01:00 committed by Brian Behlendorf
parent 8d70398740
commit 7b0dc2a317
1 changed files with 1 additions and 1 deletions

View File

@ -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);