summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Monnerat <patrick@monnerat.net>2019-02-18 15:40:34 +0100
committerPatrick Monnerat <patrick@monnerat.net>2019-02-18 15:40:34 +0100
commitfa86d32d599844902711634ab8c7ad79b64b5ace (patch)
tree578fcf283ebdde72c59d4c92f40e885bb276294d
parentaf143ef45e308a38900a9550c7fffb7f5734a97e (diff)
downloadcurl-fa86d32d599844902711634ab8c7ad79b64b5ace.tar.gz
x509asn1: replace single char with an array
Although safe in this context, using a single char as an array may cause invalid accesses to adjacent memory locations. Detected by Coverity.
-rw-r--r--lib/x509asn1.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/x509asn1.c b/lib/x509asn1.c
index 6bd9e4ed7..5410e0575 100644
--- a/lib/x509asn1.c
+++ b/lib/x509asn1.c
@@ -417,13 +417,13 @@ static const char *OID2str(const char *beg, const char *end, bool symbolic)
char *buf = (char *) NULL;
const curl_OID * op;
int n;
- char dummy;
+ char dummy[1];
/* Convert an ASN.1 OID into its dotted or symbolic string representation.
Return the dynamically allocated string, or NULL if an error occurs. */
if(beg < end) {
- n = encodeOID(&dummy, 0, beg, end);
+ n = encodeOID(dummy, 0, beg, end);
if(n >= 0) {
buf = malloc(n + 1);
if(buf) {