From: J William Piggott Date: Tue, 18 Apr 2017 14:42:02 +0000 (-0400) Subject: hwclock: --set and --predict segmentation fault X-Git-Tag: v2.30-rc1~93^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=969bffb748feea71690193ba6c6405e36a22af9b;p=thirdparty%2Futil-linux.git hwclock: --set and --predict segmentation fault Segmentation fault for --set or --predict when the --date option is not included. * sys-utils/hwclock.c: exit with an error message when the required --date option is missing. Signed-off-by: J William Piggott --- diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c index 0c587957d5..bb3a9d8970 100644 --- a/sys-utils/hwclock.c +++ b/sys-utils/hwclock.c @@ -1505,6 +1505,10 @@ int main(int argc, char **argv) } if (ctl.set || ctl.predict) { + if (!ctl.date_opt){ + warnx(_("--date is required for --set or --predict")); + hwclock_exit(&ctl, EX_USAGE); + } if (parse_date(&when, ctl.date_opt, NULL)) set_time = when.tv_sec; else {