Change in libosmocore[master]: osmo_bcd2str: also validate start_nibble parameter

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/.

neels gerrit-no-reply at lists.osmocom.org
Fri Jun 12 14:35:37 UTC 2020


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/18795 )


Change subject: osmo_bcd2str: also validate start_nibble parameter
......................................................................

osmo_bcd2str: also validate start_nibble parameter

If start_nibble were passed negative, we'd end up accessing invalid memory.
Safeguard against that.

Change-Id: Ied3c1e02c3a01d868e08195cbd8dfa52d2c19ac3
---
M src/utils.c
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/95/18795/1

diff --git a/src/utils.c b/src/utils.c
index 038288c..18e105f 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -154,7 +154,7 @@
 	int nibble_i;
 	int rc = 0;
 
-	if (!dst || dst_size < 1)
+	if (!dst || dst_size < 1 || start_nibble < 0)
 		return -ENOMEM;
 
 	for (nibble_i = start_nibble; nibble_i < end_nibble && dst < dst_end; nibble_i++, dst++) {

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ied3c1e02c3a01d868e08195cbd8dfa52d2c19ac3
Gerrit-Change-Number: 18795
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200612/88fa9470/attachment.htm>


More information about the gerrit-log mailing list