Change in libosmocore[master]: gb/gprs_ns_sns.c: fix incorrect sizeof() calculation

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Fri Apr 12 15:36:34 UTC 2019


Vadim Yanitskiy has submitted this change and it was merged. ( https://gerrit.osmocom.org/13625 )

Change subject: gb/gprs_ns_sns.c: fix incorrect sizeof() calculation
......................................................................

gb/gprs_ns_sns.c: fix incorrect sizeof() calculation

Calling sizeof() on a pointer would result in getting size of the
pointer (usually 4 or 8 bytes) itself, but not the size of the
memory it points to.

Change-Id: I83f55a9638b75d9097d37992f7c84707791f10f6
Fixes: CID#194266
---
M src/gb/gprs_ns_sns.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Vadim Yanitskiy: Looks good to me, approved
  Pau Espin Pedrol: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/gb/gprs_ns_sns.c b/src/gb/gprs_ns_sns.c
index dd8d3a2..aa8b121 100644
--- a/src/gb/gprs_ns_sns.c
+++ b/src/gb/gprs_ns_sns.c
@@ -498,7 +498,7 @@
 			}
 			/* make a copy as do_sns_delete() will change the array underneath us */
 			ip4_remote = talloc_memdup(fi, gss->ip4_remote,
-						   gss->num_ip4_remote*sizeof(v4_list));
+						   gss->num_ip4_remote*sizeof(*v4_list));
 			for (i = 0; i < gss->num_ip4_remote; i++) {
 				if (ip4_remote[i].ip_addr == ip_addr) {
 					rc = do_sns_delete(fi, &ip4_remote[i]);

-- 
To view, visit https://gerrit.osmocom.org/13625
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I83f55a9638b75d9097d37992f7c84707791f10f6
Gerrit-Change-Number: 13625
Gerrit-PatchSet: 2
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190412/d093b95f/attachment.html>


More information about the gerrit-log mailing list