diff options
author | Pali Rohár <pali.rohar@gmail.com> | 2014-10-19 18:26:47 +0200 |
---|---|---|
committer | Pali Rohár <pali.rohar@gmail.com> | 2014-10-19 18:26:47 +0200 |
commit | d6eba113578b653cd752018a2c509dbdd2eca1a6 (patch) | |
tree | ce75715268b30a8d2bc26f797201fb7fb34f9207 /src/fiasco.c | |
parent | c88e5264c979a10efe6d2209393c8df248ffc5bd (diff) | |
download | 0xFFFF-d6eba113578b653cd752018a2c509dbdd2eca1a6.tar.bz2 |
fiasco: fiasco_alloc_from_file: check if hwrevs has enough size
Diffstat (limited to 'src/fiasco.c')
-rw-r--r-- | src/fiasco.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/fiasco.c b/src/fiasco.c index 2d22747..0c404bc 100644 --- a/src/fiasco.c +++ b/src/fiasco.c @@ -192,9 +192,12 @@ struct fiasco * fiasco_alloc_from_file(const char * file) { if ( ! hwrevs[0] ) strcpy(hwrevs, hwrev); else { - /* TODO: check if hwrevs has enough size */ - strcat(hwrevs, ","); - strcat(hwrevs, hwrev); + size_t len1 = strlen(hwrevs); + size_t len2 = strlen(hwrev); + if ( len1 + len2 + 2 < sizeof(hwrevs) ) { + hwrevs[len1] = ','; + memcpy(hwrevs+len1+1, hwrev, len2+1); + } } VERBOSE(" hw revision: %s\n", hwrev); pbuf += strlen(hwrev) + 1; |