On Fri, Oct 6, 2017 at 11:04 AM Roy Marples wrote:
> On 05/10/2017 23:14, Kevin Lyda wrote:
> > That's not actually correct in practice.
> And top posting is?
>
Yes. It is. We lost that battle, sorry. If it worries you, t-prot is a
thing.
Interesting that you assume I use bash and gcc.
> This i
On 05/10/2017 23:14, Kevin Lyda wrote:
> That's not actually correct in practice.
And top posting is?
> If you'd like to see that I'm
> correct take the following two programs:
>
> foo.c:
> #include
> #include
>
> int main(int argc, char *argv[]) {
> if (strlen(argv[0]) == 0) {
> print
That's not actually correct in practice. If you'd like to see that I'm
correct take the following two programs:
foo.c:
#include
#include
int main(int argc, char *argv[]) {
if (strlen(argv[0]) == 0) {
printf("Command empty");
} else {
printf("Command not empty");
}
}
bar.c:
#inclu
On 05/10/2017 03:23, Rosen Penev wrote:
@@ -1239,7 +1238,7 @@ static struct serverfd *allocate_sfd(union mysockaddr
*addr, char *intname)
#endif
}
- if (intname && strlen(intname) != 0)
+ if (!strlen(intname))
ifindex = if_nametoindex(intname); /* index == 0 when not binding
On Wed, Oct 04, 2017 at 10:20:24PM -0700, ros...@gmail.com wrote:
>
> Compile time. Looks fine to me. To add to my commit message,
> strlen(NULL) causes a segmentation fault, meaning intname cannot be
> NULL.
>
> Actually I wonder how many more warnings I can find like this...
Probably a lot, bu
On 05/10/17 06:20, ros...@gmail.com wrote:
On Wed, 2017-10-04 at 20:43 -0700, Kurt H Maier wrote:
On Wed, Oct 04, 2017 at 07:23:22PM -0700, Rosen Penev wrote:
- if (intname && strlen(intname) != 0)
+ if (!strlen(intname))
ifindex = if_nametoindex(intname); /* index == 0 when not
bi
On Wed, 2017-10-04 at 20:43 -0700, Kurt H Maier wrote:
> On Wed, Oct 04, 2017 at 07:23:22PM -0700, Rosen Penev wrote:
> >
> > - if (intname && strlen(intname) != 0)
> > + if (!strlen(intname))
> > ifindex = if_nametoindex(intname); /* index == 0 when not
> > binding to an interface */
>
>
On Wed, Oct 04, 2017 at 07:23:22PM -0700, Rosen Penev wrote:
>
> - if (intname && strlen(intname) != 0)
> + if (!strlen(intname))
> ifindex = if_nametoindex(intname); /* index == 0 when not binding to an
> interface */
How much testing have you done of these patches?
khm
__
The function assumes intname is not NULL. Declaring it with __attribute__
((nonnull)) exposes the issue.
---
src/network.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/network.c b/src/network.c
index f6ac03b..b9786ad 100644
--- a/src/network.c
+++ b/src/network.c
@@ -