summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2012-07-03 11:31:21 +0200
committerDavid Tardon <dtardon@redhat.com>2012-07-03 17:47:20 +0200
commit38b39d3f86ac5b3afae7de3b3246544ee7412973 (patch)
tree8bed22953b6eba26a566042d9a6ed4f90ddd4024 /sal
parentac45c9867a7ccd6f4df9c981b617249c6537b86f (diff)
coverity: protect against buffer overflow
Change-Id: Id3b47712ee1457bda5313a0665a9bb34db035cb0
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/util.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sal/osl/unx/util.c b/sal/osl/unx/util.c
index 7411e7f2a81a..d40257542503 100644
--- a/sal/osl/unx/util.c
+++ b/sal/osl/unx/util.c
@@ -130,6 +130,9 @@ static int osl_getHWAddr(const char *ifname, char* hard_addr)
struct ifreq ifr;
int so = socket(AF_INET, SOCK_DGRAM, 0);
+ if (strlen(ifname) >= sizeof(ifr.ifr_name))
+ return 0;
+
strcpy(ifr.ifr_name, ifname);
/*