From c4bef9aed41d5709b7abbfaa92fb02a093d47024 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Fri, 27 Dec 2013 14:23:37 +0100 Subject: [PATCH] MIGR: use dynamic buffers to overcome max line length limits; Thanks to dtx for pointing me at this location with a POC patch. --- citadel/modules/migrate/serv_migrate.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/citadel/modules/migrate/serv_migrate.c b/citadel/modules/migrate/serv_migrate.c index d60da3e1e..f6fd819ce 100644 --- a/citadel/modules/migrate/serv_migrate.c +++ b/citadel/modules/migrate/serv_migrate.c @@ -889,12 +889,12 @@ void migr_xml_end(void *data, const char *el) { * Import begins here */ void migr_do_import(void) { - char buf[SIZ]; + StrBuf *Buf; XML_Parser xp; int linelen; unbuffer_output(); - + Buf = NewStrBufPlain(NULL, SIZ); xp = XML_ParserCreate(NULL); if (!xp) { cprintf("%d Failed to create XML parser instance\n", ERROR+INTERNAL_ERROR); @@ -908,22 +908,22 @@ void migr_do_import(void) { cprintf("%d sock it to me\n", SEND_LISTING); unbuffer_output(); - while (client_getln(buf, sizeof buf) >= 0 && strcmp(buf, "000")) { - linelen = strlen(buf); - strcpy(&buf[linelen++], "\n"); + while (CtdlClientGetLine(Buf) >= 0 && strcmp(ChrPtr(Buf), "000")) { + linelen = StrLength(Buf); + StrBufAppendBufPlain(Buf, HKEY("\n"), 0); if (server_shutting_down) break; // Should we break or return? - if (buf[0] == '\0') + if (linelen == 0) continue; - XML_Parse(xp, buf, linelen, 0); + XML_Parse(xp, ChrPtr(Buf), linelen, 0); } XML_Parse(xp, "", 0, 1); XML_ParserFree(xp); - + FreeStrBuf(&Buf); rebuild_euid_index(); rebuild_usersbynumber(); CC->dont_term = 0; -- 2.30.2