[MERGED] libosmocore[master]: fix osmo_identifier_valid(): only allow printable characters

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 Hofmeyr gerrit-no-reply at lists.osmocom.org
Sun Dec 17 21:57:58 UTC 2017


Neels Hofmeyr has submitted this change and it was merged.

Change subject: fix osmo_identifier_valid(): only allow printable characters
......................................................................


fix osmo_identifier_valid(): only allow printable characters

In particular disallow ASCII 0..31 (control characters) and 127 (DEL).

Change-Id: I04469988495af03c881fe81d7786ca7f71636299
---
M src/utils.c
1 file changed, 2 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/utils.c b/src/utils.c
index bc5329d..8f56227 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -444,6 +444,8 @@
 		/* check for 7-bit ASCII */
 		if (str[i] & 0x80)
 			return false;
+		if (!isprint((int)str[i]))
+			return false;
 		/* check for some explicit reserved control characters */
 		if (strchr(illegal_chars, str[i]))
 			return false;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I04469988495af03c881fe81d7786ca7f71636299
Gerrit-PatchSet: 3
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: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list