mirror of
https://github.com/nfc-tools/libnfc.git
synced 2026-03-01 05:06:38 +00:00
uart: prevent from retrieving more than buffer length (potential buffer overflow)
This commit is contained in:
@@ -252,7 +252,7 @@ uart_receive (serial_port sp, byte_t * pbtRx, size_t * pszRx)
|
||||
return DEIO;
|
||||
}
|
||||
// There is something available, read the data
|
||||
res = read (((serial_port_unix *) sp)->fd, pbtRx + (*pszRx), byteCount);
|
||||
res = read (((serial_port_unix *) sp)->fd, pbtRx + (*pszRx), MIN(byteCount, iExpectedByteCount));
|
||||
iExpectedByteCount -= byteCount;
|
||||
|
||||
// Stop if the OS has some troubles reading the data
|
||||
|
||||
Reference in New Issue
Block a user