[MERGED] libosmocore[master]: osmo-auc-gen: fix --sqn limit on 32bit systems, fixing build

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Mar 20 05:51:11 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: osmo-auc-gen: fix --sqn limit on 32bit systems, fixing build
......................................................................


osmo-auc-gen: fix --sqn limit on 32bit systems, fixing build

osmo-auc-gen on 32bit systems allowed only --sqn up to 32bits width. However,
the recently added regression test for osmo-auc-gen includes an ivocation with
a 48bit wide --sqn, which now causes the builds to fail on 32bit systems.

Fix the --sqn argument parsing for larger integers by using strtoull(). Do away
with the intermediate variable 'ul' and place the value directly in the auth
data struct.

Change-Id: Ifb73b3b3de06576e36076ca573d52327f90a1f77
---
M utils/osmo-auc-gen.c
1 file changed, 1 insertion(+), 3 deletions(-)

Approvals:
  Max: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/utils/osmo-auc-gen.c b/utils/osmo-auc-gen.c
index 4e2456a..6b1e623 100644
--- a/utils/osmo-auc-gen.c
+++ b/utils/osmo-auc-gen.c
@@ -106,7 +106,6 @@
 
 	while (1) {
 		int c;
-		unsigned long ul;
 		static struct option long_options[] = {
 			{ "2g", 0, 0, '2' },
 			{ "3g", 0, 0, '3' },
@@ -196,8 +195,7 @@
 				fprintf(stderr, "Only UMTS has SQN\n");
 				exit(2);
 			}
-			ul = strtoul(optarg, 0, 10);
-			test_aud.u.umts.sqn = ul;
+			test_aud.u.umts.sqn = strtoull(optarg, 0, 10);
 			/* Before calculating the UMTS auth vector,
 			 * osmo_auth_gen_vec() increments the SQN. SQN-1 here
 			 * to end up with the SQN the user requested. */

-- 
To view, visit https://gerrit.osmocom.org/2089
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifb73b3b3de06576e36076ca573d52327f90a1f77
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list