All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] common: Fix parsing SS control string
@ 2013-05-22 21:28 Lucas De Marchi
  2013-05-22 22:52 ` Lucas De Marchi
  2013-05-23  2:42 ` Denis Kenzior
  0 siblings, 2 replies; 3+ messages in thread
From: Lucas De Marchi @ 2013-05-22 21:28 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 702 bytes --]

It's not possible to be both greater than '9' and less than '0'. This
would lead to accepting things like "#$33#" as activation and "*$33#" as
deactivation, even though the string makes no sense.
---
 src/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/common.c b/src/common.c
index 94d70dd..17d1d58 100644
--- a/src/common.c
+++ b/src/common.c
@@ -554,7 +554,7 @@ gboolean parse_ss_control_string(char *str, int *ss_type,
 
 	cur = 1;
 
-	if (str[1] != '*' && str[1] != '#' && str[1] > '9' && str[1] < '0')
+	if (str[1] != '*' && str[1] != '#' && (str[1] > '9' || str[1] < '0'))
 		goto out;
 
 	if (str[0] == '#' && str[1] == '*')
-- 
1.8.2.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-05-23  2:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-22 21:28 [PATCH] common: Fix parsing SS control string Lucas De Marchi
2013-05-22 22:52 ` Lucas De Marchi
2013-05-23  2:42 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.