Usage strcpy instead of strncpy. 46/29546/1 accepted/tizen/common/20141029.134507 submit/tizen_common/20141029.113059
authorBaptiste DURAND <baptiste.durand@open.eurogiciel.org>
Wed, 29 Oct 2014 11:20:09 +0000 (12:20 +0100)
committerBaptiste DURAND <baptiste.durand@open.eurogiciel.org>
Wed, 29 Oct 2014 11:29:48 +0000 (12:29 +0100)
Sometimes   strncpy seems to have strange behavior

BUG=XWALK-2800
Change-Id: Idf11bb372e384fb23835b2a062a46d6ca0853ab1
Signed-off-by: Baptiste DURAND <baptiste.durand@open.eurogiciel.org>
app_launcher.c

index f59d1a4..45f40c7 100755 (executable)
@@ -250,7 +250,11 @@ int main(int argc, char **argv)
             case 's':
             case 'k':
             case 'r':
-                strncpy(args.applicationId, optarg, strlen(optarg));
+                if(strlen(optarg) > 255) {
+                    print_usage(argv[0]);
+                    return -1;
+                } else
+                    strcpy(args.applicationId, optarg);
                 op = next_opt;
                 break;