Fix input dir edge case bug.
authorWilhansen Li <wil@byimplication.com>
Mon, 26 Dec 2016 13:55:39 +0000 (21:55 +0800)
committerWilhansen Li <wil@byimplication.com>
Mon, 26 Dec 2016 13:55:39 +0000 (21:55 +0800)
dtbTool.c

index db99bc8b22302d1a65afde369986f9799f7bb69b..eb792e48cbec4ea9707626159437ddac0d1329de 100644 (file)
--- a/dtbTool.c
+++ b/dtbTool.c
@@ -123,7 +123,7 @@ int parse_commandline(int argc, char *const argv[])
                 input_dir = optarg;
                 {
                     int len = strlen(input_dir);
-                    if ( len > 0 && input_dir[len - 2] != '/' ) {
+                    if ( len > 1 && input_dir[len - 2] != '/' ) {
                         input_dir = malloc(len + 2);
                         strcpy(input_dir, optarg);
                         input_dir[len] = '/';