summaryrefslogtreecommitdiff
path: root/openssl.c
diff options
context:
space:
mode:
authorWilliam Ahern <william@server.local>2012-10-02 21:09:48 -0700
committerWilliam Ahern <william@server.local>2012-10-02 21:09:48 -0700
commitf0f38200ba99a767ebe0db5d171c98f25d4dbe54 (patch)
tree3d93e0ae171b2c29764c5ea09d000a0d47f7a325 /openssl.c
parent29ce5454955f7d7bf4c80599b9ab42e4aab0e979 (diff)
downloadluaossl-f0f38200ba99a767ebe0db5d171c98f25d4dbe54.tar.gz
luaossl-f0f38200ba99a767ebe0db5d171c98f25d4dbe54.tar.bz2
luaossl-f0f38200ba99a767ebe0db5d171c98f25d4dbe54.zip
-n
fix uninitialized read in timeutc(), and quiet GCC wrt for-loop declarations
Diffstat (limited to 'openssl.c')
-rw-r--r--openssl.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/openssl.c b/openssl.c
index 34b0ca8..3ae9a9f 100644
--- a/openssl.c
+++ b/openssl.c
@@ -569,11 +569,11 @@ static int xn_all(lua_State *L) {
569 ASN1_OBJECT *obj; 569 ASN1_OBJECT *obj;
570 const char *id; 570 const char *id;
571 char txt[256]; 571 char txt[256];
572 int nid, len; 572 int i, nid, len;
573 573
574 lua_newtable(L); 574 lua_newtable(L);
575 575
576 for (int i = 0; i < count; i++) { 576 for (i = 0; i < count; i++) {
577 if (!(entry = X509_NAME_get_entry(name, i))) 577 if (!(entry = X509_NAME_get_entry(name, i)))
578 continue; 578 continue;
579 579
@@ -793,10 +793,11 @@ static int xc_digest(lua_State *L) {
793 case 1: { 793 case 1: {
794 static const unsigned char x[16] = "0123456789abcdef"; 794 static const unsigned char x[16] = "0123456789abcdef";
795 luaL_Buffer B; 795 luaL_Buffer B;
796 unsigned i;
796 797
797 luaL_buffinitsize(L, &B, 2 * len); 798 luaL_buffinitsize(L, &B, 2 * len);
798 799
799 for (unsigned i = 0; i < len; i++) { 800 for (i = 0; i < len; i++) {
800 luaL_addchar(&B, x[0x0f & (md[i] >> 4)]); 801 luaL_addchar(&B, x[0x0f & (md[i] >> 4)]);
801 luaL_addchar(&B, x[0x0f & (md[i] >> 0)]); 802 luaL_addchar(&B, x[0x0f & (md[i] >> 0)]);
802 } 803 }
@@ -870,7 +871,7 @@ static _Bool scan(int *i, char **cp, int n, int signok) {
870static double timeutc(ASN1_TIME *time) { 871static double timeutc(ASN1_TIME *time) {
871 char buf[32] = "", *cp; 872 char buf[32] = "", *cp;
872 struct tm tm; 873 struct tm tm;
873 int gmtoff, year, i; 874 int gmtoff = 0, year, i;
874 double ts; 875 double ts;
875 876
876 if (!ASN1_TIME_check(time)) 877 if (!ASN1_TIME_check(time))