diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-01-25 14:46:31 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-02-09 22:13:18 +0100 |
commit | 3ea4705086b9b26a4acde7e83eb05be248ade503 (patch) | |
tree | b232ba409c3cb9b14b42d5f7ac93545a3a16d34e /ubi-utils/ubirename.c | |
parent | dcfd984d8e09db9d5a7b4d121d914442966c254f (diff) |
mtd-utils: Add checks to code that copies strings into fixed sized buffers
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'ubi-utils/ubirename.c')
-rw-r--r-- | ubi-utils/ubirename.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ubi-utils/ubirename.c b/ubi-utils/ubirename.c index f88ef82..97bf030 100644 --- a/ubi-utils/ubirename.c +++ b/ubi-utils/ubirename.c @@ -126,6 +126,13 @@ int main(int argc, char * const argv[]) rnvol.ents[count].vol_id = err; rnvol.ents[count].name_len = strlen(argv[i + 1]); + + if (rnvol.ents[count].name_len >= + sizeof(rnvol.ents[count].name)) { + errmsg("\"%s\" volume name too long", argv[i + 1]); + goto out_libubi; + } + strcpy(rnvol.ents[count++].name, argv[i + 1]); } |