From 22854544d60410770d0a43bc2ccdf36c93fbf3a9 Mon Sep 17 00:00:00 2001 From: Noah Stapp Date: Thu, 7 May 2026 11:03:59 -0400 Subject: [PATCH] Reduce code churn --- bson/_cbsonmodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bson/_cbsonmodule.c b/bson/_cbsonmodule.c index c4848af32..a87407851 100644 --- a/bson/_cbsonmodule.c +++ b/bson/_cbsonmodule.c @@ -2155,7 +2155,7 @@ static PyObject* get_value(PyObject* self, PyObject* name, const char* buffer, } memcpy(&length, buffer + *position, 4); length = BSON_UINT32_FROM_LE(length); - if (length > max - 5) { // Account for 5-byte header. max >= 5 guaranteed above + if (max - 5 < length) { // Account for 5-byte header. max >= 5 guaranteed above goto invalid; }