From f1385e222e0f080b9bba47bd680b001a3361f2bf Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 16 Jun 2014 16:03:01 +0200 Subject: [PATCH] net: leaseshelper: Don't crash if DNSMASQ doesn't provide lease expiry The value is provided via environment and causes a crash if not defined. --- src/network/leaseshelper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c index bf1842b87f..99c47a9b7b 100644 --- a/src/network/leaseshelper.c +++ b/src/network/leaseshelper.c @@ -181,7 +181,8 @@ main(int argc, char **argv) goto cleanup; /* Removed extraneous trailing space in DNSMASQ_LEASE_EXPIRES (dnsmasq < 2.52) */ - if (exptime[strlen(exptime) - 1] == ' ') + if (exptime && + exptime[strlen(exptime) - 1] == ' ') exptime[strlen(exptime) - 1] = '\0'; /* Check if it is an IPv6 lease */