From 29c656f7929ef43462c7f737a363ceecc16e3f11 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Sat, 18 Jan 2020 02:21:13 -0700 Subject: * Various fixes to copyright notices, make sure we allocate enough memory in file http.c, and move Pico version to 5.10. --- imap/src/osdep/nt/ssl_win.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'imap/src/osdep/nt') diff --git a/imap/src/osdep/nt/ssl_win.c b/imap/src/osdep/nt/ssl_win.c index 783c080a..0e77ee3c 100644 --- a/imap/src/osdep/nt/ssl_win.c +++ b/imap/src/osdep/nt/ssl_win.c @@ -497,24 +497,22 @@ static char *ssl_getline_work (SSLSTREAM *stream,unsigned long *size, return ret; } -char* ssl_getsize(SSLSTREAM* stream, unsigned long size) +char *ssl_getsize(SSLSTREAM* stream, unsigned long size) { - char* ret = NIL; + char *ret = NIL; unsigned long got = 0L, need = size, n; - int done = 0; - while (!done) { + do { if (!ssl_getdata(stream)) return ret; /* return what we have */ n = stream->ictr < need ? stream->ictr : need; - fs_resize((void**)&ret, got + n + 1); + fs_resize((void **)&ret, (got + n + 1)*sizeof(char)); memcpy(ret + got, stream->iptr, n); ret[got + n] = '\0'; got += n; need -= n; stream->iptr += n; stream->ictr -= n; - if (need == 0L) done++; - } + } while (need > 0); return ret; } -- cgit v1.2.3-70-g09d2