Change in osmocom-bb[master]: layer23: Avoid mempcy with NULL src

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

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Thu Nov 8 17:18:32 UTC 2018


Pau Espin Pedrol has submitted this change and it was merged. ( https://gerrit.osmocom.org/11610 )

Change subject: layer23: Avoid mempcy with NULL src
......................................................................

layer23: Avoid mempcy with NULL src

Fixes following ASan warning:
git/osmocom-bb/src/host/layer23/src/misc/../common/main.c:146:2: runtime error: null pointer passed as argument 2, which is declared to never be null

The warning however is harmless since in that case, app_len = 0 and thus
size to copy is 0.

Change-Id: I009a5b53f1e5be72ce347d64d3a7cb1d95d37ea3
---
M src/host/layer23/src/common/main.c
1 file changed, 2 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  Neels Hofmeyr: Looks good to me, approved



diff --git a/src/host/layer23/src/common/main.c b/src/host/layer23/src/common/main.c
index 693b10e..2920cd9 100644
--- a/src/host/layer23/src/common/main.c
+++ b/src/host/layer23/src/common/main.c
@@ -143,7 +143,8 @@
 
 	*option = talloc_zero_array(l23_ctx, struct option, len + app_len + 1);
 	memcpy(*option, long_options, sizeof(long_options));
-	memcpy(*option + len, app_opp, app_len * sizeof(struct option));
+	if (app_opp)
+		memcpy(*option + len, app_opp, app_len * sizeof(struct option));
 }
 
 static void handle_options(int argc, char **argv)

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

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I009a5b53f1e5be72ce347d64d3a7cb1d95d37ea3
Gerrit-Change-Number: 11610
Gerrit-PatchSet: 2
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181108/b3f5fb11/attachment.htm>


More information about the gerrit-log mailing list