aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-08-22 15:45:35 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-08-22 15:45:35 -0400
commit63747ac6534e3092f703527ba809eb93034bd57b (patch)
tree924420a1cb2a6e58f234d586301c1ec44793d745
parent54b6beabf05b6cf62092f98f0c06395e4242b064 (diff)
downloadbcachefs-tools-63747ac6534e3092f703527ba809eb93034bd57b.tar.gz
Fix null ptr deref in bbpos_parse()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--tools-util.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools-util.c b/tools-util.c
index 624656a1..81ce63ae 100644
--- a/tools-util.c
+++ b/tools-util.c
@@ -671,6 +671,10 @@ struct bbpos bbpos_parse(char *buf)
die("invalid bbpos %s", buf);
ret.btree = read_string_list_or_die(field, bch2_btree_ids, "btree id");
+
+ if (!s)
+ die("invalid bbpos %s", buf);
+
ret.pos = bpos_parse(s);
return ret;
}