[PATCH] Bug fixes for libgsmd-tool -m shell

Jorgen Cederlof jc at lysator.liu.se
Wed Jul 23 10:47:37 CEST 2008

I'm not subscribed to this list but just noticed the replies in the
archive. Try to include me as Cc or To.

> So for a string like "R=\0" you assume that strlen("\0") is 0? Took
> me a minute to figure that out. :)

Yeah, "R=\0" is the same string as "R=".

>> +                       } else if (!strncmp(buf, "prr=", 3) &&
>> +                                  (ptr = strchr(buf, '=')) &&
>> +                                  (fcomma = strchr(ptr+1, ','))) {

> strlen("prr=") == 4 but you use strncmp with 3?

Good catch, that's a bug.

> Hey,
> wow reviewing C string handling is no pleasure.


> From the five minute review I think there is only this one strncmp
> mistake. I would need to do a more careful review of all the fcomma,
> lcomma assignments but your patch definitely cleans up the handling
> and I will be happy to apply it once we talked about this one
> strncmp.

Good. Yeah, that strncmp was a mistake, it should have been 4.

> Have you considered using getopts of GNU to do the command line
> parsing?

Nah, that's above my current level of ambition. I'm just a user who
bought a phone as soon as they were available, was unable to choose
operator, and fixed the bug. I changed the rest since the problem was
basically the same, but I doubt I'll do much more until another itch
needs scratching.


More information about the devel mailing list