From fff535857de0a883901b08c59fd10b5781f7da44 Mon Sep 17 00:00:00 2001 From: Nicolae Rosia Date: Tue, 19 Apr 2016 08:37:30 +0300 Subject: [PATCH] drivers/gps: fix segfault when parsing arguments running gps command without parameters results in segfault due to illegal access to unallocated memory Signed-off-by: Nicolae Rosia --- src/drivers/gps/gps.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/drivers/gps/gps.cpp b/src/drivers/gps/gps.cpp index e6cf1dfa68..b4bcba56bb 100644 --- a/src/drivers/gps/gps.cpp +++ b/src/drivers/gps/gps.cpp @@ -631,6 +631,10 @@ gps_main(int argc, char *argv[]) bool fake_gps = false; bool enable_sat_info = false; + if (argc < 2) { + goto out; + } + /* * Start/load the driver. */