[rtems-libbsd commit] IFCONFIG(8): Fix write to const string
Sebastian Huber
sebh at rtems.org
Mon May 13 07:44:50 UTC 2019
Module: rtems-libbsd
Branch: 5-freebsd-12
Commit: 3549a127ec591fd4c8abe71ff3a5052e984fd5fd
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=3549a127ec591fd4c8abe71ff3a5052e984fd5fd
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Mon May 13 09:19:44 2019 +0200
IFCONFIG(8): Fix write to const string
---
freebsd/sbin/ifconfig/af_inet.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/freebsd/sbin/ifconfig/af_inet.c b/freebsd/sbin/ifconfig/af_inet.c
index 6e09c21..a6e9568 100644
--- a/freebsd/sbin/ifconfig/af_inet.c
+++ b/freebsd/sbin/ifconfig/af_inet.c
@@ -149,6 +149,12 @@ in_getaddr(const char *s, int which)
struct hostent *hp;
struct netent *np;
+#ifdef __rtems__
+ /* Memory is automatically freed */
+ s = strdup(s);
+ if (s == NULL)
+ errx(1, "no memory");
+#endif /* __rtems__ */
sin->sin_len = sizeof(*sin);
sin->sin_family = AF_INET;
More information about the vc
mailing list