summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2016-01-10 14:32:43 +0100
committerPali Rohár <pali.rohar@gmail.com>2016-01-10 14:32:43 +0100
commit3c1ab9934d91dfe04ecc29146625ffd3e900a38e (patch)
tree4251a3ce12c968dadbfd97c2d4ca29d49536b239
parentb48b9b558c89783f812e6afbcdecb9d2a2153ad4 (diff)
download0xFFFF-3c1ab9934d91dfe04ecc29146625ffd3e900a38e.tar.bz2
main: Check for SW rel version length
-rw-r--r--src/main.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index a6994b8..cea36f7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -834,9 +834,16 @@ int main(int argc, char **argv) {
char * swver = strchr(fiasco_gen_arg, '%');
if ( swver )
*(swver++) = 0;
+ if ( swver && strlen(swver) >= sizeof(fiasco_out->swver) ) {
+ ERROR("SW rel version is too long");
+ ret = 1;
+ goto clean;
+ }
fiasco_out = fiasco_alloc_empty();
if ( ! fiasco_out ) {
ERROR("Cannot write images to fiasco file %s", fiasco_gen_arg);
+ ret = 1;
+ goto clean;
} else {
if ( swver )
strcpy(fiasco_out->swver, swver);