libusbgx: Fix readlink/buffer overrun issue. CID#56130, CID#56129
authorPhilippe De Swert <philippe.deswert@jollamobile.com>
Tue, 13 May 2014 12:55:57 +0000 (15:55 +0300)
committerKrzysztof Opasiak <k.opasiak@samsung.com>
Tue, 22 Dec 2015 19:38:54 +0000 (20:38 +0100)
commit6c199393e429ba7fe13f950cdb839e95d5c6926e
treeea9d46c2476767acc0008af58698a6e1783ba9a0
parentbc1bf2e15a7604ecd4cf1becb17e3c8cd7c7cee2
libusbgx: Fix readlink/buffer overrun issue. CID#56130, CID#56129

Readlink() can return the total length of the buffer (here 4096/USBG_MAX_PATH_LENGTH),
so we do not want to dereference target[4096] as that would give an off by one error.

Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
[Port from libusbg and update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
src/usbg.c