From 9059861edf2ba68c5ea356918a0347323c9f0d2b Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Sat, 21 Dec 2019 06:35:51 -0500 Subject: Null-terminate read literals No wonder there was garbage... Silly mistake! --- imbox.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'imbox.c') diff --git a/imbox.c b/imbox.c index 9f46983..1712615 100644 --- a/imbox.c +++ b/imbox.c @@ -65,8 +65,6 @@ static void mboxrd(const char *headers, const char *body) { ); printf("%s", headers); - // FIXME: There seems to sometimes be some garbage data at the end of the - // headers? static regex_t quoteRegex; compile("eRegex, "^>*From "); @@ -161,12 +159,13 @@ static char *readLiteral(FILE *imap, const char *line) { size_t size = strtoul(prefix + 1, NULL, 10); if (!size) errx(EX_PROTOCOL, "invalid literal size"); - char *literal = malloc(size); + char *literal = malloc(size + 1); if (!literal) err(EX_OSERR, "malloc"); size_t count = fread(literal, size, 1, imap); if (!count) errx(EX_PROTOCOL, "could not read literal"); + literal[size] = '\0'; return literal; } -- cgit 1.4.1 ef='/src/tree/doc/zlib/compress.3?id=066b65515e7d35ed0de41ca3f5f351f394457c2b'>tree commit diff
path: root/doc/zlib/compress.3 (unfollow)
Commit message (Expand)Author
2022-04-17Add HenchJune McEnroe
2022-04-14Publish "Agency"June McEnroe
2022-04-13Swap dates so the difference is always positiveJune McEnroe
2022-04-04Update "Care"June McEnroe
2022-04-03Publish "Care"June McEnroe
2022-03-31Publish "Compassion"June McEnroe
2022-03-24Skip matches with ident chars on either sideJune McEnroe
2022-03-24Add The Invisible Life of Addie LaRueJune McEnroe
2022-03-22Source ~/.profile.local if it existsJune McEnroe
2022-03-18Publish "Addendum 2021"June McEnroe
2022-03-16Remove wcwidth portJune McEnroe
2022-03-16Remove -j4 from ./PlanJune McEnroe
2022-03-15Rewrite Linux install.sh for DebianJune McEnroe
2022-03-15Remove dashJune McEnroe