* [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
* Re: [PATCH] common: Fix parsing SS control string
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
1 sibling, 0 replies; 3+ messages in thread
From: Lucas De Marchi @ 2013-05-22 22:52 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1011 bytes --]
On Wed, May 22, 2013 at 6:28 PM, Lucas De Marchi
<lucas.demarchi@profusion.mobi> wrote:
> 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;
this is actually caught later in the function:
for (i = 0; i < strlen(*sc); i++)
if (!g_ascii_isdigit((*sc)[i]))
goto out;
But fixing the check would be good.
Lucas De Marchi
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] common: Fix parsing SS control string
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
1 sibling, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2013-05-23 2:42 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 994 bytes --]
Hi Lucas,
On 05/22/2013 04:28 PM, Lucas De Marchi wrote:
> 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'))
Funny how it is hiding in plain sight and nobody has found it in over 4
years. And I think you just got an award for finding the oldest bug :P
Patch has been applied, thanks.
> goto out;
>
> if (str[0] == '#' && str[1] == '*')
>
Regards,
-Denis
^ permalink raw reply [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.