diff options
author | Daniel Willmann <dwillmann@sysmocom.de> | 2021-10-29 17:34:24 +0200 |
---|---|---|
committer | Daniel Willmann <dwillmann@sysmocom.de> | 2021-10-29 17:34:24 +0200 |
commit | dd28f827471568bca710e6663191a0a547c8053d (patch) | |
tree | 4c1f7364f7577895c9241bbe75afff52724a4b45 | |
parent | 9ecdc11eb6b983748ae2fd6a1d07849c8106826f (diff) |
gprs_bssgp_pcu: Fix crash when configuring an existing ns binddaniel/sys4971
ns_configure_nse() only sets bind when it doesn't exist yet. If it
already exists bind[i] stays NULL and causes a segfault in
gprs_ns2_is_ip_bind() later on.
This patch ensures bind[i] is either created of set to the existing
bind.
Change-Id: I103e82e6c64324c087a4ff325a83eeab0e5a4ee9
Related: SYS#4971
-rw-r--r-- | src/gprs_bssgp_pcu.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gprs_bssgp_pcu.c b/src/gprs_bssgp_pcu.c index 1fcacdb1..0dd6cdcd 100644 --- a/src/gprs_bssgp_pcu.c +++ b/src/gprs_bssgp_pcu.c @@ -1118,7 +1118,8 @@ static int ns_configure_nse(struct gprs_rlcmac_bts *bts, if (!(valid & (1 << i))) continue; - if (!gprs_ns2_ip_bind_by_sockaddr(the_pcu->nsi, &local[i])) { + bind[i] = gprs_ns2_ip_bind_by_sockaddr(the_pcu->nsi, &local[i]); + if (!bind[i]) { snprintf(name, sizeof(name), "pcu%u", i); rc = gprs_ns2_ip_bind(the_pcu->nsi, name, &local[i], 0, &bind[i]); if (rc < 0) { |