Fixed stack-buffer-overflow reported by AddressSanitizer 33/182133/1 accepted/tizen/5.0/unified/20181102.030456 accepted/tizen/unified/20180621.141526 submit/tizen/20180621.050911 submit/tizen_5.0/20181101.000007
authorSaurav Babu <saurav.babu@samsung.com>
Tue, 19 Jun 2018 08:53:23 +0000 (14:23 +0530)
committerTaesoo Jun <steve.jun@samsung.com>
Wed, 20 Jun 2018 23:20:34 +0000 (23:20 +0000)
commitfcd14a96afbe4cfb6f11f3b1153ed203b2bf0862
tree5988c321ca4e5d2c2f63a6d708e5b699576da695
parent1797636e9884398468b225a7500fb22d25ae4ce3
Fixed stack-buffer-overflow reported by AddressSanitizer

mdnsd==1744==ERROR: AddressSanitizer: stack-buffer-overflow on address 0xbe328549 at pc 0xb62b78e9 bp 0xbe327df8 sp 0xbe327e08
READ of size 16 at 0xbe328549 thread T0
 #0 0xb62b78e7  (/usr/lib/libasan.so+0x4c8e7)
 #1 0x4e9b7b in get_ifi_info_linuxv6 /usr/src/debug/mdnsresponder-765.50.9/mDNSPosix/mDNSUNP.c:160
 #2 0x4ea1c3 in get_ifi_info /usr/src/debug/mdnsresponder-765.50.9/mDNSPosix/mDNSUNP.c:231
 #3 0x4e2c5f in SetupInterfaceList /usr/src/debug/mdnsresponder-765.50.9/mDNSPosix/mDNSPosix.c:978
 #4 0x4e5c23 in mDNSPlatformInit /usr/src/debug/mdnsresponder-765.50.9/mDNSPosix/mDNSPosix.c:1349
 #5 0x5c627b in mDNS_Init ../mDNSCore/mDNS.c:14534
 #6 0x4db4eb in main /usr/src/debug/mdnsresponder-765.50.9/mDNSPosix/PosixDaemon.c:179
 #7 0xb610c63b  (/lib/libc.so.6+0x1663b)

Address 0xbe328549 is located in stack of thread T0 at offset 649 in frame
 #0 0x4e93af in get_ifi_info_linuxv6 /usr/src/debug/mdnsresponder-765.50.9/mDNSPosix/mDNSUNP.c:84

In memcpy() function 16 bytes were copied but ifname variable only
contained 9 bytes.

Change-Id: Ib977c9c469e0df88e16aa69a1cb2708b34f9269c
Signed-off-by: Saurav Babu <saurav.babu@samsung.com>
(cherry picked from commit 66a4ec013b29e6b00fb8e7a52efc289e99d56340)
mDNSPosix/mDNSUNP.c