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//
@@ -55,9 +55,9 @@ typedef enum cups_asn1_e cups_asn1_t; // ASN1 request/object types
5555
5656typedef struct cups_snmp_string_s // String value
5757{
58- unsigned char bytes [CUPS_SNMP_MAX_STRING ];
59- // Bytes in string
6058 unsigned num_bytes ; // Number of bytes
59+ unsigned char bytes [CUPS_SNMP_MAX_STRING + 1 ];
60+ // Bytes in string
6161} cups_snmp_string_t ;
6262
6363union 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 *
@@ -1014,10 +1014,14 @@ asn1_decode_snmp(unsigned char *buffer, /* I - Buffer */
10141014 case CUPS_ASN1_OCTET_STRING :
10151015 case CUPS_ASN1_BIT_STRING :
10161016 case CUPS_ASN1_HEX_STRING :
1017- packet -> object_value .string .num_bytes = length ;
10181017 asn1_get_string (& bufptr , bufend , length ,
10191018 (char * )packet -> object_value .string .bytes ,
10201019 sizeof (packet -> object_value .string .bytes ));
1020+
1021+ if (length >= sizeof (packet -> object_value .string .bytes ))
1022+ packet -> object_value .string .num_bytes = sizeof (packet -> object_value .string .bytes ) - 1 ;
1023+ else
1024+ packet -> object_value .string .num_bytes = length ;
10211025 break ;
10221026
10231027 case CUPS_ASN1_OID :
You can’t perform that action at this time.
0 commit comments