diff options
author | Nick Kralevich <nnk@google.com> | 2012-07-11 14:30:39 -0700 |
---|---|---|
committer | Nick Kralevich <nnk@google.com> | 2012-07-11 14:30:39 -0700 |
commit | 8d61c6ee30ea24755dfd111fb497c0533c0ff461 (patch) | |
tree | 8672586770d12ba04b2cc5841da05ebf37b79087 | |
parent | cf36684dd6ea25b2490317f2f76d2586b4c3e834 (diff) | |
download | mdnsresponder-jb-mr1.1-dev-plus-aosp.tar.gz |
Don't call memcpy() with size > srcandroid-sdk-support_r11android-cts-4.2_r2android-cts-4.2_r1android-4.2_r1android-4.2.2_r1.2android-4.2.2_r1.1android-4.2.2_r1android-4.2.1_r1.2android-4.2.1_r1.1android-4.2.1_r1tools_r22jb-mr1.1-releasejb-mr1.1-dev-plus-aospjb-mr1.1-devjb-mr1-releasejb-mr1-dev-plus-aospjb-mr1-dev
FORTIFY_SOURCE detected code of the form
char foo[10];
char bar[20];
memcpy(bar, foo, 20);
this code has a read buffer overflow, reading more data
from foo than it contains.
Change-Id: I7b85a2788763a839ce66a37ba84d597167c4a078
-rwxr-xr-x | mDNSPosix/mDNSUNP.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mDNSPosix/mDNSUNP.c b/mDNSPosix/mDNSUNP.c index 7feff31..fb107b5 100755 --- a/mDNSPosix/mDNSUNP.c +++ b/mDNSPosix/mDNSUNP.c @@ -117,7 +117,7 @@ struct ifi_info *get_ifi_info_linuxv6(int family, int doaliases) continue; /* already processed this interface */ myflags = IFI_ALIAS; } - memcpy(lastname, ifname, IFNAMSIZ); + strncpy(lastname, ifname, IFNAMSIZ); ifi = (struct ifi_info*)calloc(1, sizeof(struct ifi_info)); if (ifi == NULL) { goto gotError; @@ -164,13 +164,13 @@ struct ifi_info *get_ifi_info_linuxv6(int family, int doaliases) /* Add interface name */ - memcpy(ifi->ifi_name, ifname, IFI_NAME); + strncpy(ifi->ifi_name, ifname, IFI_NAME); /* Add interface index */ ifi->ifi_index = index; /* Add interface flags*/ - memcpy(ifr.ifr_name, ifname, IFNAMSIZ); + strncpy(ifr.ifr_name, ifname, IFNAMSIZ); if (ioctl(sockfd, SIOCGIFFLAGS, &ifr) < 0) { if (errno == EADDRNOTAVAIL) { /* |