aboutsummaryrefslogtreecommitdiff
blob: f570f9dc81c7d7422f74028eb333a799b840f018 (plain)
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
diff -Naurw libressl-2.3.0.orig/crypto/objects/obj_dat.c libressl-2.3.0/crypto/objects/obj_dat.c
--- libressl-2.3.0.orig/crypto/objects/obj_dat.c	2014-12-06 15:15:50.000000000 -0800
+++ libressl-2.3.0/crypto/objects/obj_dat.c	2015-10-16 17:18:54.534556199 -0700
@@ -491,7 +491,6 @@
 {
 	int i, ret = 0, len, nid, first = 1, use_bn;
 	BIGNUM *bl = NULL;
-	char *bndec = NULL;
 	unsigned long l;
 	const unsigned char *p;
 
@@ -567,14 +566,16 @@
 		}
 
 		if (use_bn) {
+			char *bndec;
+
 			bndec = BN_bn2dec(bl);
 			if (!bndec)
 				goto err;
 			i = snprintf(buf, buf_len, ".%s", bndec);
+			free(bndec);
 			if (i == -1)
 				goto err;
 			if (i >= buf_len) {
-				buf += buf_len;
 				buf_len = 0;
 			} else {
 				buf += i;
@@ -586,7 +587,6 @@
 			if (i == -1)
 				goto err;
 			if (i >= buf_len) {
-				buf += buf_len;
 				buf_len = 0;
 			} else {
 				buf += i;
@@ -598,13 +598,11 @@
 	}
 
 out:
-	free(bndec);
 	BN_free(bl);
 	return ret;
 
 err:
 	ret = 0;
-	buf[0] = '\0';
 	goto out;
 }