mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
r16213: Fix Klocwork #852. iface_n_ip can potentially
return NULL. Ensure we don't deref.
Jeremy.
(This used to be commit c2f0ea2ff2
)
This commit is contained in:
parent
d4a80fdf38
commit
a5da0a72e1
@ -120,6 +120,7 @@ in workgroup %s on subnet %s\n",
|
||||
if( subrec == unicast_subnet ) {
|
||||
struct nmb_name nmbname;
|
||||
struct in_addr my_first_ip;
|
||||
struct in_addr *nip;
|
||||
|
||||
/* Put our name and first IP address into the
|
||||
workgroup struct as domain master browser. This
|
||||
@ -130,7 +131,14 @@ in workgroup %s on subnet %s\n",
|
||||
|
||||
work->dmb_name = nmbname;
|
||||
/* Pick the first interface ip address as the domain master browser ip. */
|
||||
my_first_ip = *iface_n_ip(0);
|
||||
nip = iface_n_ip(0);
|
||||
|
||||
if (!nip) {
|
||||
DEBUG(0,("become_domain_master_stage2: Error. iface_n_ip returned NULL\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
my_first_ip = *nip;
|
||||
|
||||
putip((char *)&work->dmb_addr, &my_first_ip);
|
||||
|
||||
|
@ -220,7 +220,13 @@ BOOL create_subnets(void)
|
||||
|
||||
if (lp_we_are_a_wins_server()) {
|
||||
/* Pick the first interface ip address as the WINS server ip. */
|
||||
unicast_ip = *iface_n_ip(0);
|
||||
struct in_addr *nip = iface_n_ip(0);
|
||||
|
||||
if (!nip) {
|
||||
return False;
|
||||
}
|
||||
|
||||
unicast_ip = *nip;
|
||||
} else {
|
||||
/* note that we do not set the wins server IP here. We just
|
||||
set it at zero and let the wins registration code cope
|
||||
|
Loading…
Reference in New Issue
Block a user