diff options
author | Stephen Warren <swarren@nvidia.com> | 2018-09-14 14:35:24 -0600 |
---|---|---|
committer | Stephen Warren <swarren@nvidia.com> | 2018-09-17 09:31:03 -0600 |
commit | 9de64c77f0567ac3fbcc4ce62a7090a6bae84360 (patch) | |
tree | 5d203820581598665c662af9e18ab9dc5bf7bdb1 /src/parse.c | |
parent | 7c9db585d06cce9efffa2a82245f233233680060 (diff) | |
download | cbootimage-9de64c77f0567ac3fbcc4ce62a7090a6bae84360.tar.gz |
Fix various abort(), crashes, and memory errors
cbootimage doesn't have extensive error-checking of the input files. Thus
it's easy to trigger aborts (which in turn segfault to exit the app) and
bad memory accesses by providing under-sized binary input files or
configuration files with missing required statements. Add a bit more
error-checking to clean up some of these cases. No doubt there are more,
but this change only fixes those that have been reported.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'src/parse.c')
-rw-r--r-- | src/parse.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/parse.c b/src/parse.c index 99cb428..1006093 100644 --- a/src/parse.c +++ b/src/parse.c @@ -249,7 +249,7 @@ parse_filename(char *str, char *name, int chars_remaining) * Check if the filename buffer is out of space, preserving one * character to null terminate the string. */ - while (isalnum(*str) || strchr("\\/~_-+:.@", *str)) { + while (*str && (isalnum(*str) || strchr("\\/~_-+:.@", *str))) { chars_remaining--; |