Change in libosmocore[master]: gb/gprs_ns_sns.c: fix incorrect buffer size calculation

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

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


Vadim Yanitskiy has uploaded this change for review. ( https://gerrit.osmocom.org/13625


Change subject: gb/gprs_ns_sns.c: fix incorrect buffer size calculation
......................................................................

gb/gprs_ns_sns.c: fix incorrect buffer size calculation

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

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



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/25/13625/1

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: newchange
Gerrit-Change-Id: I83f55a9638b75d9097d37992f7c84707791f10f6
Gerrit-Change-Number: 13625
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190412/67697dad/attachment.htm>


More information about the gerrit-log mailing list