smpp_smsc: use osmo_talloc_replace_string() in smpp_smsc_conf()

Change-Id: Ie3dc0d9673a0410a5908cba77fc352d581bac6f6
Fixes: CID#240711
changes/30/25930/4
Vadim Yanitskiy 1 year ago committed by fixeria
parent 97b8e76b50
commit e0661105ac
  1. 8
      src/libmsc/smpp_smsc.c

@ -987,14 +987,8 @@ int smpp_smsc_conf(struct smsc *smsc, const char *bind_addr, uint16_t port)
/* Avoid use-after-free if bind_addr == smsc->bind_addr */
if (smsc->bind_addr == bind_addr)
return 0;
osmo_talloc_replace_string(smsc, &smsc->bind_addr, bind_addr);
talloc_free((void*)smsc->bind_addr);
smsc->bind_addr = NULL;
if (bind_addr) {
smsc->bind_addr = bind_addr ? talloc_strdup(smsc, bind_addr) : NULL;
if (!smsc->bind_addr)
return -ENOMEM;
}
return 0;
}

Loading…
Cancel
Save