SHA256
1
0
forked from pool/fetchmail
fetchmail/fetchmail-add-query_to64_outsize-utility-function.patch
David Anes d3007028df Accepting request 991826 from home:mcepl:branches:server:mail
- Update to 6.4.32:
  * Use configure to find rst2html, some systems install it only
    with .py suffix, others only without, and some install both.
  * Update README.maintainer
  * Translations updated.
- Reapplied patches
- Add 44-uncorrupt_runfetchmail.patch to clean up some contrib/
  scripts (gl#fetchmail/fetchmail#44).

OBS-URL: https://build.opensuse.org/request/show/991826
OBS-URL: https://build.opensuse.org/package/show/server:mail/fetchmail?expand=0&rev=137
2022-08-01 07:35:53 +00:00

38 lines
1.3 KiB
Diff

From: Matthew Ogilvie <mmogilvi+fml@zoho.com>
Date: Fri, 21 Dec 2018 09:00:46 -0700
Subject: add query_to64_outsize() utility function
Git-repo: https://gitlab.com/fetchmail/fetchmail.git
Git-commit: cc6e146d516140df800da68976eb7c0aa1cef7c0
---
base64.c | 7 +++++++
fetchmail.h | 1 +
2 files changed, 8 insertions(+)
--- a/base64.c
+++ b/base64.c
@@ -66,6 +66,13 @@ fail:
return rc;
}
+size_t query_to64_outsize(size_t inlen)
+/* Returns how much space needs to be allocated to receive the output from
+ * to64frombits(), including the '\0' terminator. */
+{
+ return ((inlen+2)/3)*4+1;
+}
+
int from64tobits(void *out_, const char *in, int maxlen)
/* base 64 to raw bytes in quasi-big-endian order, returning count of bytes */
/* maxlen limits output buffer size, set to zero to ignore */
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -642,6 +642,7 @@ int prc_filecheck(const char *, const fl
/* base64.c */
unsigned len64frombits(unsigned inlen); /** calculate length needed to encode inlen octets. warnings: 1. caller needs to add 1 for a trailing \0 byte himself. 2. returns 0 for inlen 0! */
int to64frombits(char *, const void *, int inlen, size_t outlen);
+size_t query_to64_outsize(size_t inlen);
int from64tobits(void *, const char *, int mxoutlen);
/* unmime.c */