Fix gcc 4.6 warnings. Check TLS server hello extension length.
[oweals/openssl.git] / crypto / conf / conf_def.c
index 996a0999ac04a3562a87c35a0db7c76c019cf609..3c58936d9928b23b58a4905a983c0674dbda8753 100644 (file)
@@ -88,7 +88,7 @@ static int def_dump(const CONF *conf, BIO *bp);
 static int def_is_number(const CONF *conf, char c);
 static int def_to_int(const CONF *conf, char c);
 
-const char *CONF_def_version="CONF_def" OPENSSL_VERSION_PTEXT;
+const char CONF_def_version[]="CONF_def" OPENSSL_VERSION_PTEXT;
 
 static CONF_METHOD default_method = {
        "OpenSSL default",
@@ -213,13 +213,14 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
        int bufnum=0,i,ii;
        BUF_MEM *buff=NULL;
        char *s,*p,*end;
-       int again,n;
+       int again;
        long eline=0;
        char btmp[DECIMAL_SIZE(eline)+1];
        CONF_VALUE *v=NULL,*tv;
        CONF_VALUE *sv=NULL;
        char *section=NULL,*buf;
-       STACK_OF(CONF_VALUE) *section_sk=NULL,*ts;
+/*     STACK_OF(CONF_VALUE) *section_sk=NULL;*/
+/*     STACK_OF(CONF_VALUE) *ts=NULL;*/
        char *start,*psection,*pname;
        void *h = (void *)(conf->data);
 
@@ -250,7 +251,7 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
                                        CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
                goto err;
                }
-       section_sk=(STACK_OF(CONF_VALUE) *)sv->value;
+/*     section_sk=(STACK_OF(CONF_VALUE) *)sv->value;*/
 
        bufnum=0;
        again=0;
@@ -309,7 +310,6 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
                buf=buff->data;
 
                clear_comments(conf, buf);
-               n=strlen(buf);
                s=eat_ws(conf, buf);
                if (IS_EOF(conf,*s)) continue; /* blank line */
                if (*s == '[')
@@ -343,7 +343,7 @@ again:
                                        CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
                                goto err;
                                }
-                       section_sk=(STACK_OF(CONF_VALUE) *)sv->value;
+/*                     section_sk=(STACK_OF(CONF_VALUE) *)sv->value;*/
                        continue;
                        }
                else
@@ -406,12 +406,12 @@ again:
                                           CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
                                        goto err;
                                        }
-                               ts=(STACK_OF(CONF_VALUE) *)tv->value;
+/*                             ts=(STACK_OF(CONF_VALUE) *)tv->value;*/
                                }
                        else
                                {
                                tv=sv;
-                               ts=section_sk;
+/*                             ts=section_sk;*/
                                }
 #if 1
                        if (_CONF_add_string(conf, tv, v) == 0)
@@ -465,9 +465,6 @@ err:
 
 static void clear_comments(CONF *conf, char *p)
        {
-       char *to;
-
-       to=p;
        for (;;)
                {
                if (IS_FCOMMENT(conf,*p))
@@ -613,13 +610,13 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from)
                                e++;
                                }
                        /* So at this point we have
-                        * ns which is the start of the name string which is
+                        * np which is the start of the name string which is
                         *   '\0' terminated. 
-                        * cs which is the start of the section string which is
+                        * cp which is the start of the section string which is
                         *   '\0' terminated.
                         * e is the 'next point after'.
-                        * r and s are the chars replaced by the '\0'
-                        * rp and sp is where 'r' and 's' came from.
+                        * r and rr are the chars replaced by the '\0'
+                        * rp and rrp is where 'r' and 'rr' came from.
                         */
                        p=_CONF_get_string(conf,cp,np);
                        if (rrp != NULL) *rrp=rr;
@@ -638,6 +635,11 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from)
                           points at.  /RL */
                        len -= e-from;
                        from=e;
+
+                       /* In case there were no braces or parenthesis around
+                          the variable reference, we have to put back the
+                          character that was replaced with a '\0'.  /RL */
+                       *rp = r;
                        }
                else
                        buf->data[to++]= *(from++);