Skip to content
Snippets Groups Projects
Commit 07e23d4e authored by deuce's avatar deuce
Browse files

Strip leading zero bytes from public key values.

parent 734aa821
Branches
Tags
No related merge requests found
......@@ -134,6 +134,10 @@ static void js_simple_asn1(unsigned char *data, size_t len, JSContext *cx, JSObj
n = malloc(sz);
if (n == NULL)
return;
while(data[off] == 0) {
off++;
sz--;
}
memcpy(n, data+off, sz);
n64 = malloc(sz*4/3+3);
if (n64 == NULL) {
......@@ -161,6 +165,10 @@ static void js_simple_asn1(unsigned char *data, size_t len, JSContext *cx, JSObj
free(n64);
return;
}
while(data[off] == 0) {
off++;
sz--;
}
memcpy(e, data+off, sz);
e64 = malloc(sz*4/3+3);
if (e64 == NULL) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment