From 805d353584a74e874df3f077dbe1d6239bb50d3f Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sun, 21 Apr 2013 14:30:21 +0100 Subject: [PATCH] getdata: certain input files caused SIGSEGV When dhcpd.conf file got to be parsed such way that IP version could not be determined the dhcpd.lease file parsing resulted to SIGSEGV. Reported-by: Joey D. Signed-off-by: Sami Kerola --- THANKS | 1 + src/other.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/THANKS b/THANKS index f5f6554..fb9f030 100644 --- a/THANKS +++ b/THANKS @@ -26,3 +26,4 @@ Ryan Malek Cheer Xiao Gilles Bouthenot Helmut Grohne +Joey D. diff --git a/src/other.c b/src/other.c index 226fe30..fbdb3c0 100644 --- a/src/other.c +++ b/src/other.c @@ -160,6 +160,10 @@ int xstrstr(const char *restrict a, const char *restrict b, const int len) { int i; + /* Skip when config.dhcp_version == VERSION_UNKNOWN -> len is zero. */ + if (len == 0) { + return false; + } /* two spaces are very common in lease file, after them * nearly everything differs */ if (likely(a[2] != b[2])) {