mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-03-25 13:29:03 +02:00
util/nvmutil: unambiguous sign conv_argv_part_num
yeah, do the verification manually, don't convert to size_t. this avoids a bunch of theoretical bugs that i can't be bothered to explain at 3AM just trust me bro Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -331,10 +331,12 @@ conv_argv_part_num(const char *part_str)
|
||||
if (part_str[0] == '\0' || part_str[1] != '\0')
|
||||
err(EINVAL, "Partnum string '%s' wrong length", part_str);
|
||||
|
||||
ch = (unsigned char)part_str[0] - '0';
|
||||
ch = (unsigned char)part_str[0];
|
||||
|
||||
check_part_num((size_t)ch);
|
||||
return (size_t)ch;
|
||||
if (ch < '0' || ch > '1')
|
||||
err(EINVAL, "Bad part number (%c)", ch);
|
||||
|
||||
return (size_t)(ch - '0');
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user