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.
This commit is contained in:
Peter Krempa 2014-06-16 16:03:01 +02:00
parent 5133b50372
commit f1385e222e

View File

@ -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 */