Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7e02124

Browse filesBrowse files
RaisinTentargos
authored andcommitted
dgram: add nread assertion to UDPWrap::OnRecv
This asserts that the number of bytes received by the socket is less than or equal to the size allocated for the temporary storage. Signed-off-by: Darshan Sen <darshan.sen@postman.com> PR-URL: #40295 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
1 parent 38d8138 commit 7e02124
Copy full SHA for 7e02124

File tree

Expand file treeCollapse file tree

1 file changed

+1
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+1
-1
lines changed
Open diff view settings
Collapse file

‎src/udp_wrap.cc‎

Copy file name to clipboardExpand all lines: src/udp_wrap.cc
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
// USE OR OTHER DEALINGS IN THE SOFTWARE.
2121

2222
#include "udp_wrap.h"
23-
#include "allocated_buffer-inl.h"
2423
#include "env-inl.h"
2524
#include "node_buffer.h"
2625
#include "node_sockaddr-inl.h"
@@ -725,6 +724,7 @@ void UDPWrap::OnRecv(ssize_t nread,
725724
} else if (nread == 0) {
726725
bs = ArrayBuffer::NewBackingStore(isolate, 0);
727726
} else {
727+
CHECK_LE(static_cast<size_t>(nread), bs->ByteLength());
728728
bs = BackingStore::Reallocate(isolate, std::move(bs), nread);
729729
}
730730

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.