comparison libcoding/check_high_bit.c @ 12:0fe95ca922c7

sms-gen-tpdu: check the high bit of GSM7 msg input
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 05 Aug 2023 16:55:24 +0000
parents
children
comparison
equal deleted inserted replaced
11:9ed03ed4e673 12:0fe95ca922c7
1 /*
2 * The function implemented in this module is intended for validating inputs
3 * that are expected to be in the form of GSM7 characters carried in an octet
4 * string, where the high bit of every octet is expected to be cleared.
5 */
6
7 #include <sys/types.h>
8
9 check_high_bit(buf, len)
10 u_char *buf;
11 unsigned len;
12 {
13 unsigned n;
14
15 for (n = 0; n < len; n++) {
16 if (buf[n] & 0x80)
17 return(-1);
18 }
19 return(0);
20 }