From d88ded29d968b8ccf41d4dffa73c3f8f030a9f5d Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Tue, 25 Apr 2017 19:28:04 +0300 Subject: Fix possible UB in ReadFile() This patch replicates commit 225ef1baeb0e49f157f3ba1271915e623bd27dd9 for Windows. Change-Id: Ic4e3444183289e7ce1a487500633fb5ad95590b9 Reviewed-by: Denis Shienkov --- src/serialport/qserialport_win.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp index 84bf5b9..0494889 100644 --- a/src/serialport/qserialport_win.cpp +++ b/src/serialport/qserialport_win.cpp @@ -545,7 +545,7 @@ bool QSerialPortPrivate::startAsyncRead() if (readBufferMaxSize && bytesToRead > (readBufferMaxSize - buffer.size())) { bytesToRead = readBufferMaxSize - buffer.size(); - if (bytesToRead == 0) { + if (bytesToRead <= 0) { // Buffer is full. User must read data from the buffer // before we can read more from the port. return false; -- cgit v1.2.1