-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathcups-large-snmp-lengths.patch
68 lines (62 loc) · 2.27 KB
/
cups-large-snmp-lengths.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
diff -up cups-1.4.2/cups/snmp.c.large-snmp-lengths cups-1.4.2/cups/snmp.c
--- cups-1.4.2/cups/snmp.c.large-snmp-lengths 2009-09-22 19:47:36.000000000 +0100
+++ cups-1.4.2/cups/snmp.c 2010-04-13 16:42:05.490022665 +0100
@@ -3,7 +3,7 @@
*
* SNMP functions for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007-2009 by Apple Inc.
+ * Copyright 2007-2010 by Apple Inc.
* Copyright 2006-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -89,14 +89,14 @@ static char *asn1_get_string(unsigned c
unsigned char *bufend,
int length, char *string,
int strsize);
-static int asn1_get_length(unsigned char **buffer,
+static unsigned asn1_get_length(unsigned char **buffer,
unsigned char *bufend);
static int asn1_get_type(unsigned char **buffer,
unsigned char *bufend);
static void asn1_set_integer(unsigned char **buffer,
int integer);
static void asn1_set_length(unsigned char **buffer,
- int length);
+ unsigned length);
static void asn1_set_oid(unsigned char **buffer,
const int *oid);
static void asn1_set_packed(unsigned char **buffer,
@@ -1299,18 +1299,26 @@ asn1_get_integer(
* 'asn1_get_length()' - Get a value length.
*/
-static int /* O - Length */
+static unsigned /* O - Length */
asn1_get_length(unsigned char **buffer, /* IO - Pointer in buffer */
unsigned char *bufend) /* I - End of buffer */
{
- int length; /* Length */
+ unsigned length; /* Length */
length = **buffer;
(*buffer) ++;
if (length & 128)
- length = asn1_get_integer(buffer, bufend, length & 127);
+ {
+ int count; /* Number of bytes for length */
+
+
+ for (count = length & 127, length = 0;
+ count > 0 && *buffer < bufend;
+ count --, (*buffer) ++)
+ length = (length << 8) | **buffer;
+ }
return (length);
}
@@ -1529,7 +1537,7 @@ asn1_set_integer(unsigned char **buffer,
static void
asn1_set_length(unsigned char **buffer, /* IO - Pointer in buffer */
- int length) /* I - Length value */
+ unsigned length) /* I - Length value */
{
if (length > 255)
{