diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-08 14:49:57 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-08 14:49:57 +0000 |
| commit | e6767d6e47ea254f69a51dcbb733f06264c77c2c (patch) | |
| tree | a59508eba61dea0b65af796ce69a7ee779646d80 | |
| parent | 6f2e5149f292d7f67ffa551a0934104f7481440d (diff) | |
util/nvmutil: make xstrxcmp() easier to read
Signed-off-by: Leah Rowe <leah@libreboot.org>
| -rw-r--r-- | util/nvmutil/nvmutil.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 35504729..a876c5d4 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -1130,7 +1130,7 @@ xstrxcmp(const char *a, const char *b, size_t maxlen) { size_t i; - if (!a || !b) + if (a == NULL || b == NULL) err(EINVAL, "NULL input to xstrxcmp"); if (*a == '\0' || *b == '\0') @@ -1144,6 +1144,9 @@ xstrxcmp(const char *a, const char *b, size_t maxlen) return 0; } + /* + * We reached maxlen, so assume unterminated string. + */ err(EINVAL, "Unterminated string in xstrxcmp"); /* |
