summaryrefslogtreecommitdiff
path: root/egg
diff options
context:
space:
mode:
authorStef Walter <stefw@gnome.org>2012-08-01 11:15:07 +0200
committerStef Walter <stefw@gnome.org>2012-08-08 11:09:27 +0200
commit7f18d97354042cc6f95ebba0a4a4089ab891e066 (patch)
tree98f0bc774838644f07a401771377d115273b772f /egg
parentfc0ad2f2eb09ce746f6267489517ea120ad6c7fc (diff)
downloadgcr-7f18d97354042cc6f95ebba0a4a4089ab891e066.tar.gz
asn1x: Fix assertion in loading of default integer
Diffstat (limited to 'egg')
-rw-r--r--egg/egg-asn1x.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/egg/egg-asn1x.c b/egg/egg-asn1x.c
index 1717127..5168e3f 100644
--- a/egg/egg-asn1x.c
+++ b/egg/egg-asn1x.c
@@ -2167,6 +2167,7 @@ anode_write_integer_ulong (gulong value,
gint bytes, i, off;
guchar *at;
gboolean sign;
+ gsize len;
for (i = 0; i < sizeof (gulong); ++i) {
off = sizeof (gulong) - (i + 1);
@@ -2184,9 +2185,10 @@ anode_write_integer_ulong (gulong value,
/* If the first byte would make this negative, then add a zero */
at = buf + (sizeof (gulong) - bytes);
sign = !!(at[0] & 0x80);
+ len = bytes + (sign ? 1 : 0);
if (data) {
- g_assert (*n_data >= bytes + 1);
+ g_assert (*n_data >= len);
if (sign) {
data[0] = 0;
data++;
@@ -2194,7 +2196,7 @@ anode_write_integer_ulong (gulong value,
memcpy (data, at, bytes);
}
- *n_data = bytes + (sign ? 1 : 0);
+ *n_data = len;
}
static GBytes *