From 224baa071bf7d1ea40c661eb928bc4697f24fe8c Mon Sep 17 00:00:00 2001 From: Nick Chambers Date: Wed, 29 Jun 2022 16:06:49 -0500 Subject: [PATCH] Increase `idx` in `gargoyle_find_brand` by the negate size --- src/sleuth.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sleuth.c b/src/sleuth.c index a677139..d51326a 100644 --- a/src/sleuth.c +++ b/src/sleuth.c @@ -5,11 +5,16 @@ #include struct gargoyle_opt *gargoyle_find_brand(uint16_t optc, struct gargoyle_opt *optv, const char *brand, const char *neg, uint16_t neg_sz, gargoyle_flag_type flags) { + if(!neg) { + neg = "no-"; + neg_sz = 3; + } + for(; optc; optc -= 1, optv += 1) { const char *idx = brand; if(optv->type & GARGOYLE_TYPE_BOOL && gargoyle_cmp(idx, neg, neg_sz, flags)) { - idx += 3; + idx += neg_sz; } uint8_t end = !*(idx + optv->brand_sz);