main: Check for SW rel version length

This commit is contained in:
Pali Rohár committed 2016-01-10 14:32:43 +01:00
1 parent b48b9b558c
commit 3c1ab9934d
1 file changed
+7
+7
View File
@@ -834,9 +834,16 @@ int main(int argc, char **argv) {
char * swver = strchr(fiasco_gen_arg, '%'); char * swver = strchr(fiasco_gen_arg, '%');
if ( swver ) if ( swver )
*(swver++) = 0; *(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(); fiasco_out = fiasco_alloc_empty();
if ( ! fiasco_out ) { if ( ! fiasco_out ) {
ERROR("Cannot write images to fiasco file %s", fiasco_gen_arg); ERROR("Cannot write images to fiasco file %s", fiasco_gen_arg);
ret = 1;
goto clean;
} else { } else {
if ( swver ) if ( swver )
strcpy(fiasco_out->swver, swver); strcpy(fiasco_out->swver, swver);