ntpd: do not SEGV on "-p keyno:192.168.1.1", show --help instead
authorDenys Vlasenko <vda.linux@googlemail.com>
Sat, 24 Nov 2018 23:42:56 +0000 (00:42 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sat, 24 Nov 2018 23:42:56 +0000 (00:42 +0100)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
networking/ntpd.c

index 4f86072442d5ac0da1d97c69e6a451864c6d1547..041cac76265370a520730666fa1b346b844b4012 100644 (file)
@@ -2539,6 +2539,7 @@ static NOINLINE void ntp_init(char **argv)
                                int key_id;
                                peer += 6;
                                end = strchr(peer, ':');
+                               if (!end) bb_show_usage();
                                *end = '\0';
                                key_id = xatou_range(peer, 1, MAX_KEY_NUMBER);
                                *end = ':';