Always copy null terminator when filtering smartcard list

This commit is contained in:
Alex Wilson 2020-04-08 21:03:02 +10:00 committed by akallabeth
parent d7795c892b
commit c6e675bfb7

View File

@ -456,12 +456,16 @@ static DWORD filter_device_by_name_a(wLinkedList* list, LPSTR* mszReaders, DWORD
LPCSTR rreader = &(*mszReaders)[rpos];
LPSTR wreader = &(*mszReaders)[wpos];
size_t readerLen = strnlen(rreader, cchReaders - rpos);
if (readerLen == 0)
break;
rpos += readerLen + 1;
if (filter_match(list, rreader, readerLen))
{
if (rreader != wreader)
memmove(wreader, rreader, readerLen);
memmove(wreader, rreader, readerLen + 1);
wpos += readerLen + 1;
}