diff gen-pdu/message.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 17dd30989c0b
children d9d722033ff1
line wrap: on
line diff
--- a/gen-pdu/message.c	Sat Aug 05 08:44:32 2023 +0000
+++ b/gen-pdu/message.c	Sat Aug 05 16:55:24 2023 +0000
@@ -111,6 +111,11 @@
 		udh_chars = 0;
 	}
 	plain_chars = input_len - udhl1;
+	if (check_high_bit(input + udhl1, plain_chars) < 0) {
+		fprintf(stderr, ERR_PREFIX "high bit set in GSM7 data\n",
+			input_lineno);
+		exit(1);
+	}
 	udl = udh_chars + plain_chars;
 	if (udl > 160) {
 		fprintf(stderr, ERR_PREFIX