From c276e9ff608cc9bad19e599044ec238a6eb890ab Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 8 Jun 2014 12:41:20 +0200 Subject: [PATCH] Return early if ASN1 string is invalid --- src/x509.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/x509.c b/src/x509.c index e89b602..d34353c 100644 --- a/src/x509.c +++ b/src/x509.c @@ -88,8 +88,10 @@ static void push_asn1_string(lua_State* L, ASN1_STRING *string, int encode) { int len; unsigned char *data; - if (!string) + if (!string) { lua_pushnil(L); + return; + } switch (encode) { case LSEC_AI5_STRING: lua_pushlstring(L, (char*)ASN1_STRING_data(string),