tFix *$num handling for headers. - rohrpost - A commandline mail client to change the world as we see it.
 (HTM) git clone git://r-36.net/rohrpost
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 612b4635f36c5ad16c9c651416a3c85111dce99a
 (DIR) parent cc1288fba991ad4fe8b9d5fffe809565cb6c1585
 (HTM) Author: Christoph Lohmann <20h@r-36.net>
       Date:   Sun, 28 Oct 2018 17:57:51 +0100
       
       Fix *$num handling for headers.
       
       Diffstat:
         mime.c                              |       9 +++++++--
       
       1 file changed, 7 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/mime.c b/mime.c
       t@@ -538,7 +538,8 @@ mime_sanitizeparams(llist_t *params)
                        key = param->key;
                        klen = strlen(key);
        
       -                if (key[klen-1] == '*') {
       +                //printf("key = %s\n", key);
       +                if (key[klen-2] == '*') {
                                nvalue = mime_decodeparam((char *)param->data);
                                if (nvalue != NULL) {
                                        //printf("decoded: %s\n", nvalue);
       t@@ -546,7 +547,8 @@ mime_sanitizeparams(llist_t *params)
                                        param->data = nvalue;
                                        param->datalen = strlen(nvalue)+1;
                                }
       -                        key[--klen] = '\0';
       +                        key[klen-2] = '\0';
       +                        //printf("key after = %s\n", key);
                        }
        
                        nvalue = strrchr(param->key, '*');
       t@@ -825,6 +827,7 @@ mime_preparepart(mime_t *mime)
                llistelem_t *hdr, *field;
                llist_t *hdrf;
        
       +        //printf("mime = %p\n", mime);
                hdr = llist_ciget(mime->hdrs, "content-type");
                if (hdr != NULL && hdr->data != NULL && strlen(hdr->data) > 0) {
                        //printf("content-type: %s\n", (char *)hdr->data);
       t@@ -984,6 +987,8 @@ mimeparsebufagain:
        mimeparsebufbodyparse:
                //printf("body parsing begins.\n");
                mime = mime_preparepart(mime);
       +        if (mime == NULL)
       +                return NULL;
        
                /*
                 * It is not a multipart message, so take the remainder