Changeset: 12d367f26425 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=12d367f26425
Modified Files:
        clients/mapiclient/mclient.c
Branch: Oct2014
Log Message:

Fix use of iconv parameters.
This fixes stray "NULL byte in input" errors.


diffs (34 lines):

diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -1833,10 +1833,12 @@ doFileBulk(Mapi mid, FILE *fp)
                                size_t fromlen;
                                char *to, *nbuf;
                                size_t tolen = length * 4 + 1;
+                               size_t otolen;
 
                                if (tolen <= bufsize)
                                        tolen = bufsize + 1;
                          retry:
+                               otolen = tolen;
                                from = buf;
                                fromlen = length;
                                nbuf = to = malloc(tolen);
@@ -1848,7 +1850,7 @@ doFileBulk(Mapi mid, FILE *fp)
                                                fprintf(stderr, "Illegal input 
sequence\n");
                                                return 1;
                                        case E2BIG:
-                                               tolen *= 2;
+                                               tolen = otolen * 2;
                                                free(nbuf);
                                                goto retry;
                                        case EINVAL:
@@ -1859,7 +1861,7 @@ doFileBulk(Mapi mid, FILE *fp)
                                                return 1;
                                        }
                                }
-                               length = tolen;
+                               length = otolen - tolen;
                                free(buf);
                                buf = nbuf;
                        }
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to