]> git.sur5r.net Git - u-boot/commitdiff
tools: Check arguments in fit_check_sign/fit_info
authorSimon Glass <sjg@chromium.org>
Thu, 12 Jun 2014 13:24:44 +0000 (07:24 -0600)
committerTom Rini <trini@ti.com>
Thu, 19 Jun 2014 15:18:57 +0000 (11:18 -0400)
These tools crash if no arguments are provided. Add checks to avoid this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Heiko Schocher <hs@denx.de>
tools/fit_check_sign.c
tools/fit_info.c

index af257cc8a2a2bf0bce3b51efc78f9aa58d1db4a0..e1198bca4498983593b31b9afd16b35c7713c202 100644 (file)
@@ -62,6 +62,15 @@ int main(int argc, char **argv)
                        break;
        }
 
+       if (!fdtfile) {
+               fprintf(stderr, "%s: Missing fdt file\n", *argv);
+               usage(*argv);
+       }
+       if (!keyfile) {
+               fprintf(stderr, "%s: Missing key file\n", *argv);
+               usage(*argv);
+       }
+
        ffd = mmap_fdt(cmdname, fdtfile, 0, &fit_blob, &fsbuf, false);
        if (ffd < 0)
                return EXIT_FAILURE;
index afbed7b5995a69a261bae2a4d055963c9fc9b543..481ac6dd8147c3cab6261edab0f3c994911a2189 100644 (file)
@@ -68,6 +68,18 @@ int main(int argc, char **argv)
                        break;
                }
 
+       if (!fdtfile) {
+               fprintf(stderr, "%s: Missing fdt file\n", *argv);
+               usage(*argv);
+       }
+       if (!nodename) {
+               fprintf(stderr, "%s: Missing node name\n", *argv);
+               usage(*argv);
+       }
+       if (!propertyname) {
+               fprintf(stderr, "%s: Missing property name\n", *argv);
+               usage(*argv);
+       }
        ffd = mmap_fdt(cmdname, fdtfile, 0, &fit_blob, &fsbuf, false);
 
        if (ffd < 0) {