[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/4] lwip: Fix a buffer overflow and clear compiler warnings
From: |
Joan Lledó |
Subject: |
[PATCH 4/4] lwip: Fix a buffer overflow and clear compiler warnings |
Date: |
Tue, 7 Aug 2018 18:02:43 +0200 |
---
lwip/options.c | 2 +-
lwip/pfinet-ops.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lwip/options.c b/lwip/options.c
index 6591ac52..d35b9f32 100644
--- a/lwip/options.c
+++ b/lwip/options.c
@@ -133,7 +133,7 @@ parse_opt (int opt, char *arg, struct argp_state *state)
}
in = h->curint;
- strncpy (in->dev_name, arg, DEV_NAME_LEN);
+ strncpy (in->dev_name, arg, sizeof(in->dev_name)-1);
break;
case 'a':
diff --git a/lwip/pfinet-ops.c b/lwip/pfinet-ops.c
index 56b7dcd1..1af2a3fe 100644
--- a/lwip/pfinet-ops.c
+++ b/lwip/pfinet-ops.c
@@ -61,7 +61,7 @@ dev_ifconf (struct ifconf *ifc)
memset (ifr, 0, sizeof (struct ifreq));
strncpy (ifr->ifr_name, netif_get_state (netif)->devname,
- strlen (netif_get_state (netif)->devname) + 1);
+ sizeof (ifr->ifr_name)-1);
saddr->sin_len = sizeof (struct sockaddr_in);
saddr->sin_family = AF_INET;
saddr->sin_addr.s_addr = netif_ip4_addr (netif)->addr;
--
2.17.1
- Patches: lwip translator, Joan Lledó, 2018/08/07
- [PATCH 1/4] lwip: select/poll(): return EIO when POLLERR is set, Joan Lledó, 2018/08/07
- [PATCH 3/4] lwip: return EINTR when a select() IPC thread is cancelled, Joan Lledó, 2018/08/07
- [PATCH 2/4] lwip: refactor main demuxer to avoid code duplication, Joan Lledó, 2018/08/07
- [PATCH 4/4] lwip: Fix a buffer overflow and clear compiler warnings,
Joan Lledó <=
- Re: Patches: lwip translator, Samuel Thibault, 2018/08/09
- [PATCH 2/4] lwip: refactor main demuxer to avoid code duplication, Joan Lledó, 2018/08/11
- Re: [PATCH 2/4] lwip: refactor main demuxer to avoid code duplication, Samuel Thibault, 2018/08/13
- [PATCH 4/4] lwip: Fix a buffer overflow and clear compiler warnings, Joan Lledó, 2018/08/11
- Re: [PATCH 4/4] lwip: Fix a buffer overflow and clear compiler warnings, Samuel Thibault, 2018/08/14