carl9170 firmware tools: fix off-by-one segmentation fault in fwprepare
authorChristian Lamparter <chunkeey@googlemail.com>
Sat, 23 Nov 2013 13:22:55 +0000 (14:22 +0100)
committerChristian Lamparter <chunkeey@googlemail.com>
Sat, 23 Nov 2013 13:22:55 +0000 (14:22 +0100)
This patch fixes a segmentation fault which would occur if the
firmware had the PATTERN_GENERATOR feature bit set, but didn't
have the pattern descriptor.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
tools/src/fwprepare.c

index 891dad2aae52790eb6a77036bcf5bc9d2a08763f..eb8a5f80acaa1edeba7fb3bb313ae9e7f9ab8181 100644 (file)
@@ -24,7 +24,7 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
-#include "../../carlfw/include/radar.h"
+#include "pattern.h"
 #include "carlfw.h"
 
 #include "compiler.h"
@@ -67,6 +67,7 @@ static int add_radars(struct carlfw *fw) {
        if (!radar_desc) {
                fprintf(stderr, "Firmware has radar pattern feature set, but "
                        "can't find a valid radar descriptor\n");
+               return 0;
        }
 
        radars_to_add = radar_desc->num_radars -