Review at  https://gerrit.osmocom.org/5427

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(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/27/5427/1

diff --git a/src/utils.c b/src/utils.c
index bc5329d..6d9e9f1 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(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: newchange
Gerrit-Change-Id: I04469988495af03c881fe81d7786ca7f71636299
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <[email protected]>

Reply via email to