summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2014-05-19 10:12:53 +0100
committerPhilip Withnall <philip.withnall@collabora.co.uk>2014-05-19 10:15:37 +0100
commit4c07f41c343ccbf5001de2ca6b7cbc004f03c6da (patch)
tree5c2dc43db0d4be9cd049c56cd9b39f942eb3d219
parent878ab1d340cdbddecaf90646699298ecd3ae96dc (diff)
downloadgssdp-4c07f41c343ccbf5001de2ca6b7cbc004f03c6da.tar.gz
gssdp-client: Use strncpy() instead of strcpy()
Limit the length of the string copied so a malicious interface name cannot overwrite parts of the stack. Coverity issue: #60337 https://bugzilla.gnome.org/show_bug.cgi?id=730358
-rw-r--r--libgssdp/gssdp-client.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libgssdp/gssdp-client.c b/libgssdp/gssdp-client.c
index 587e912..144ebaf 100644
--- a/libgssdp/gssdp-client.c
+++ b/libgssdp/gssdp-client.c
@@ -1261,7 +1261,7 @@ query_ifindex (const char *iface_name)
return -1;
memset (&ifr, 0, sizeof(struct ifreq));
- strcpy (ifr.ifr_ifrn.ifrn_name, iface_name);
+ strncpy (ifr.ifr_ifrn.ifrn_name, iface_name, IFNAMSIZ);
result = ioctl (fd, SIOCGIFINDEX, (char *)&ifr);
close (fd);