On fre, aug 28, 2026 at 14:19, "Sascha Hauer" <[email protected]> wrote:
> On 2026-08-24 18:31, Tobias Waldekranz wrote:
>> +
>> +const lvm_tok_t *lvm_md_vgsect(const struct lvm_md *md, const lvm_tok_t 
>> **keyp)
>> +{
>> +    const lvm_tok_t *key, *val;
>> +
>> +    lvm_md_for_each(md, key, &md->tokens[0]) {
>> +            val = key + 1;
>
> Should you check against num_tokens here?

Good catch, yes I should!

>
>> +            if (val->type == LVM_TOK_SECTION) {
>> +                    if (keyp)
>> +                            *keyp = key;
>> +                    return val;
>> +            }
>> +    }
>> +
>> +    return NULL;
>> +}
>> +
>
>> +const lvm_tok_t *lvm_md_find(const struct lvm_md *md, const lvm_tok_t *sec,
>> +                         const char *key)
>> +{
>> +    const lvm_tok_t *k;
>> +
>> +    if (sec->type != LVM_TOK_SECTION)
>> +            return NULL;
>> +
>> +    lvm_md_for_each(md, k, sec) {
>> +            if (lvm_md_tok_eq(md, k, key))
>> +                    return k + 1;
>
> Here as well. Fuzzing might indeed be useful ;)

Indeed :) Thanks for the thorough review!

Reply via email to