mirror of
https://github.com/openbsd/src.git
synced 2026-06-18 15:23:33 +02:00
Include the padding length when testing the remaining bytes in an octet
string, to prevent a size_t underflow on a malformed packet and make us run into infinity. Same diff as for snmpd
This commit is contained in:
+2
-2
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: ax.c,v 1.11 2025/09/08 08:43:39 jsg Exp $ */
|
||||
/* $OpenBSD: ax.c,v 1.12 2026/05/07 14:51:20 martijn Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2019 Martijn van Duren <martijn@openbsd.org>
|
||||
*
|
||||
@@ -1286,7 +1286,7 @@ ax_pdutoostring(struct ax_pdu_header *header,
|
||||
ostring->aos_slen = ax_pdutoh32(header, buf);
|
||||
rawlen -= 4;
|
||||
buf += 4;
|
||||
if (ostring->aos_slen > rawlen)
|
||||
if (((ostring->aos_slen + 3) & ~3U) > rawlen)
|
||||
goto fail;
|
||||
if ((ostring->aos_string = malloc(ostring->aos_slen + 1)) == NULL)
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user