fetchmail/fetchmail-oauth2-c-calculate-and-pass-in-correct-buffer-size-to-to64frombits.patch

36 lines
1.2 KiB
Diff
Raw Permalink Normal View History

Accepting request 1227336 from home:ayankov:branches:server:mail - Upgrade to 6.5.1 * Drop two wolfSSL compile-time checks that were for older 6.4 or for future 7.0 releases and broke compilation with wolfSSL 5.7.4. Fixes https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=282413#c4 * Use %p instead of non-portable %#p for one wolfSSL-related diagnostic message (FreeBSD defines %#p to be %p, on many other platforms it's undefined behavior). * Add regex_helper.c to list of files that contain translatable strings, which contains two strings we missed to translate. * Simplify EVP_MD_fetch API detection ("like OpenSSL 3" vs. "like OpenSSL 1") for version switch and base it on the claimed OpenSSL version of the crypto SSL, which works for LibreSSL (claims OpenSSL 2) and wolfSSL alike. * Several translations added - Rebased fetchmail-6.3.8-smtp_errors.patch - Rebased fetchmail-FAQ-list-gmail-options-including-oauthbearer-and-app.patch - Rebased fetchmail-add-contrib-fetchnmail-oauth2.py-token-acquisition-u.patch - Rebased fetchmail-add-imap-oauthbearer-support.patch - Rebased fetchmail-add-passwordfile-and-passwordfd-options.patch - Rebased fetchmail-add-query_to64_outsize-utility-function.patch - Rebased fetchmail-bump-max-passwordlen-to-1bytes.patch - Rebased fetchmail-give-each-ctl-it-s-own-copy-of-password.patch - Rebased fetchmail-increase-max-password-length-to-handle-oauth-tokens.patch - Rebased fetchmail-re-read-passwordfile-on-every-poll.patch - Rebased fetchmail-support-oauthbearer-xoauth2-with-pop3.patch - Rebased fetchmailconf-no-more-future.patch OBS-URL: https://build.opensuse.org/request/show/1227336 OBS-URL: https://build.opensuse.org/package/show/server:mail/fetchmail?expand=0&rev=159
2024-11-29 14:58:57 +00:00
From: Matthew Ogilvie <mmogilvi+fml@zoho.com>
Date: Fri, 21 Dec 2018 09:01:40 -0700
Subject: oauth2.c: calculate and pass in correct buffer size to to64frombits()
Git-repo: https://gitlab.com/fetchmail/fetchmail.git
Git-commit: 914ee333c73baa3c58d1e819ff4d66052e663335
Also allocate the actual needed size instead of an excessively large
approximate size.
---
oauth2.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/oauth2.c
+++ b/oauth2.c
@@ -34,6 +34,7 @@ char *get_oauth2_string(struct query *ct
int oauth2len;
char *oauth2b64;
+ size_t oauth2b64alloc;
oauth2len = strlen(ctl->remotename) + strlen(ctl->password) + 32;
oauth2str = (char *)xmalloc(oauth2len);
@@ -52,8 +53,9 @@ char *get_oauth2_string(struct query *ct
ctl->password);
}
- oauth2b64 = (char *)xmalloc(2*strlen(oauth2str)+8);
- to64frombits(oauth2b64, oauth2str, strlen(oauth2str), oauth2len);
+ oauth2b64alloc = query_to64_outsize(strlen(oauth2str));
+ oauth2b64 = (char *)xmalloc(oauth2b64alloc);
+ to64frombits(oauth2b64, oauth2str, strlen(oauth2str), oauth2b64alloc);
memset(oauth2str, 0x55, strlen(oauth2str));
free(oauth2str);