diff options
author | Maks Mishin <maks.mishinfz@gmail.com> | 2025-02-09 18:46:21 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2025-02-18 16:32:24 -0600 |
commit | 320ba79911511d7f29d3092fb4cc4f5b7a03d7da (patch) | |
tree | e74ab56fdd942990ee3bd7e28503cce8657de712 | |
parent | 87eaf7781a3cc116c2fb04eac2471ac33f538291 (diff) | |
download | u-boot-320ba79911511d7f29d3092fb4cc4f5b7a03d7da.tar.gz |
tools: Fix potential null-deref with result of strtok_r
Return value of a function 'strtok_r' is dereferenced at kwbimage.c:1655
without checking for NULL, but it is usually checked for this function.
Signed-off-by: Maks Mishin <maks.mishinFZ@gmail.com>
-rw-r--r-- | tools/kwbimage.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/kwbimage.c b/tools/kwbimage.c index d1cbced28fc..3dcf5ba66b9 100644 --- a/tools/kwbimage.c +++ b/tools/kwbimage.c @@ -1653,6 +1653,12 @@ static int image_create_config_parse_oneline(char *line, char *unknown_msg = "Ignoring unknown line '%s'\n"; keyword = strtok_r(line, delimiters, &saveptr); + + if (!keyword) { + fprintf(stderr, "Parameter missing in line '%s'\n", line); + return -1; + } + keyword_id = recognize_keyword(keyword); if (!keyword_id) { |