nhttpd: fix stack buffer overflow

This commit is contained in:
Jacek Jendrzej
2018-11-30 17:54:11 +01:00
parent 2f9a25d066
commit 3dc0434bd3

View File

@@ -486,7 +486,8 @@ std::string CySocket::ReceiveLine() {
else
break;
}
buffer[++bytes_gotten] = '\0';
if (bytes_gotten < MAX_LINE_BUFFER - 1)
buffer[++bytes_gotten] = '\0';
result.assign(buffer, bytes_gotten);
return result;