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:
parent
8d70398740
commit
7b0dc2a317
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue