git.samba.org
/
samba.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ef1a0c1
)
Fix our asn.1 parser to handle negative numbers.
author
Jeremy Allison
<jra@samba.org>
Tue, 24 May 2011 19:47:31 +0000
(12:47 -0700)
committer
Karolin Seeger
<kseeger@samba.org>
Thu, 26 May 2011 18:21:38 +0000
(20:21 +0200)
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Tue May 24 22:57:16 CEST 2011 on sn-devel-104
(cherry picked from commit
e719dfd4dc178f001a5f804fb1ac4e587574415f
)
Fix bug #8163 (asn.1 library does not correctly read negative integers).
(cherry picked from commit
859d13141cd831488b60e413f7141514ae4464b5
)
lib/util/asn1.c
patch
|
blob
|
history
diff --git
a/lib/util/asn1.c
b/lib/util/asn1.c
index 70c2c57450cc1de869fab961de8ea55911e8c9e4..0d696c699781db5bf5baab87560639b6ef7151b9 100644
(file)
--- a/
lib/util/asn1.c
+++ b/
lib/util/asn1.c
@@
-716,10
+716,19
@@
bool asn1_read_ContextSimple(struct asn1_data *data, uint8_t num, DATA_BLOB *blo
bool asn1_read_implicit_Integer(struct asn1_data *data, int *i)
{
uint8_t b;
+ bool first_byte = true;
*i = 0;
while (!data->has_error && asn1_tag_remaining(data)>0) {
if (!asn1_read_uint8(data, &b)) return false;
+ if (first_byte) {
+ if (b & 0x80) {
+ /* Number is negative.
+ Set i to -1 for sign extend. */
+ *i = -1;
+ }
+ first_byte = false;
+ }
*i = (*i << 8) + b;
}
return !data->has_error;