File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11/*
22 * Private SNMP definitions for CUPS.
33 *
4- * Copyright © 2020-2024 by OpenPrinting.
4+ * Copyright © 2020-2026 by OpenPrinting.
55 * Copyright © 2007-2014 by Apple Inc.
66 * Copyright © 2006-2007 by Easy Software Products, all rights reserved.
77 *
@@ -58,9 +58,9 @@ typedef enum cups_asn1_e cups_asn1_t; /**** ASN1 request/object types ****/
5858
5959typedef struct cups_snmp_string_s /**** String value ****/
6060{
61- unsigned char bytes [CUPS_SNMP_MAX_STRING ];
62- /* Bytes in string */
6361 unsigned num_bytes ; /* Number of bytes */
62+ unsigned char bytes [CUPS_SNMP_MAX_STRING + 1 ];
63+ /* Bytes in string */
6464} cups_snmp_string_t ;
6565
6666union cups_snmp_value_u /**** Object value ****/
Original file line number Diff line number Diff line change 11/*
22 * SNMP functions for CUPS.
33 *
4- * Copyright © 2020-2024 by OpenPrinting.
4+ * Copyright © 2020-2026 by OpenPrinting.
55 * Copyright © 2007-2019 by Apple Inc.
66 * Copyright © 2006-2007 by Easy Software Products, all rights reserved.
77 *
@@ -1042,10 +1042,14 @@ asn1_decode_snmp(unsigned char *buffer, /* I - Buffer */
10421042 case CUPS_ASN1_OCTET_STRING :
10431043 case CUPS_ASN1_BIT_STRING :
10441044 case CUPS_ASN1_HEX_STRING :
1045- packet -> object_value .string .num_bytes = length ;
10461045 asn1_get_string (& bufptr , bufend , length ,
10471046 (char * )packet -> object_value .string .bytes ,
10481047 sizeof (packet -> object_value .string .bytes ));
1048+
1049+ if (length >= sizeof (packet -> object_value .string .bytes ))
1050+ packet -> object_value .string .num_bytes = sizeof (packet -> object_value .string .bytes ) - 1 ;
1051+ else
1052+ packet -> object_value .string .num_bytes = length ;
10491053 break ;
10501054
10511055 case CUPS_ASN1_OID :
You can’t perform that action at this time.
0 commit comments