If only given the -e/--extended option we would fail due to the assumption that arg would contain the address to be parsed. Make sure we check for NULL here instead of segfault. Signed-off-by: Stefan Schmidt <stefan@xxxxxxxxxxxxxxx> --- wpan-ping/wpan-ping.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wpan-ping/wpan-ping.c b/wpan-ping/wpan-ping.c index 9f01ae6..5429ca3 100644 --- a/wpan-ping/wpan-ping.c +++ b/wpan-ping/wpan-ping.c @@ -385,6 +385,9 @@ static int parse_dst_addr(struct config *conf, char *arg) { int i; + if (!arg) + return -1; + /* PAN ID is filled from netlink in get_interface_info */ conf->dst.family = AF_IEEE802154; @@ -422,7 +425,7 @@ static int parse_dst_addr(struct config *conf, char *arg) int main(int argc, char *argv[]) { int c, ret; struct config *conf; - char *dst_addr; + char *dst_addr = NULL; conf = malloc(sizeof(struct config)); -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-wpan" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html