discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] GUI problems with 3.7


From: Sylvain Munaut
Subject: Re: [Discuss-gnuradio] GUI problems with 3.7
Date: Sat, 22 Jun 2013 10:50:12 +0200

> In this case, I /know/ that string
> b is properly terminated (because I wrote it into the code). So I use
> the length of b to compare with a and l = strlen(b). There are other
> ways, too, but this was the most unobtrusive way to handle this case.

Huh ... but strcmp will stop comparing at the end of any of the two
strings anyway.

So I don't see how this: (
https://github.com/gnuradio/gnuradio/commit/c1e91f0200a58a6cb24d1de9422f1a6e2483fc2c
)

-      if (strcmp (name, all[i]->name ()) == 0){
+      if (strncmp (name, all[i]->name(), strlen(all[i]->name())) == 0){

would provide any more safety again "bad" user strings.

The only difference this code will make is that now "all[i]->name()"
only needs to be a _prefix_ to "name" rather than a full length match.
(which may very well fix the original issue but doesn't do much about
"unsafe non null terminated strings")


Cheers,

    Sylvain



reply via email to

[Prev in Thread] Current Thread [Next in Thread]