From ba8e3e03432ee7649a3f59ba8b37edbb32c34190 Mon Sep 17 00:00:00 2001 From: Richard Sharpe Date: Sun, 9 Sep 2001 09:59:33 +0000 Subject: Make sure that if there are no interfaces, name_register_wins does not segfault. (This used to be commit a7842fac94a3f772da0e6ddf14044df24af798a9) --- source3/libsmb/namequery.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index 4a3cf43b35..39159be41b 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -560,6 +560,13 @@ BOOL name_register_wins(const char *name, int name_type) int num_interfaces = iface_count(); struct in_addr sendto_ip; + /* + * Check if we have any interfaces, prevents a segfault later + */ + + if (num_interfaces <= 0) + return False; /* Should return some indication of the problem */ + /* * Do a broadcast register ... */ -- cgit