aboutsummaryrefslogtreecommitdiffstats
path: root/smtp.c
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2018-04-14 21:39:58 +0200
committerMatthias Andree <matthias.andree@gmx.de>2018-04-14 21:39:58 +0200
commit9deaf399553050b3b426e8a39d0ffd22430bf72d (patch)
tree9bf7de273c7a2936ff07a0da67b1cbec2aab72a5 /smtp.c
parent3a36394465a4e6e3c64bb5b1255717df753bb4a9 (diff)
downloadfetchmail-9deaf399553050b3b426e8a39d0ffd22430bf72d.tar.gz
fetchmail-9deaf399553050b3b426e8a39d0ffd22430bf72d.tar.bz2
fetchmail-9deaf399553050b3b426e8a39d0ffd22430bf72d.zip
In-depth fix for to64frombits() BASE64 encoder buffer sizing.
Diffstat (limited to 'smtp.c')
-rw-r--r--smtp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/smtp.c b/smtp.c
index 1c99c696..01e709d0 100644
--- a/smtp.c
+++ b/smtp.c
@@ -106,7 +106,7 @@ static void SMTP_auth(int sock, char smtp_mode, char *username, char *password,
digest[9], digest[10], digest[11], digest[12], digest[13],
digest[14], digest[15]);
- to64frombits(b64buf, tmp, strlen(tmp));
+ to64frombits(b64buf, tmp, strlen(tmp), sizeof b64buf);
SockPrintf(sock, "%s\r\n", b64buf);
SMTP_ok(sock, smtp_mode, TIMEOUT_DEFAULT);
}
@@ -122,7 +122,7 @@ static void SMTP_auth(int sock, char smtp_mode, char *username, char *password,
if (tmp[c] == '^')
tmp[c] = '\0';
}
- to64frombits(b64buf, tmp, len);
+ to64frombits(b64buf, tmp, len, sizeof b64buf);
SockPrintf(sock, "AUTH PLAIN %s\r\n", b64buf);
SMTP_ok(sock, smtp_mode, TIMEOUT_DEFAULT);
}
@@ -144,7 +144,7 @@ static void SMTP_auth(int sock, char smtp_mode, char *username, char *password,
SMTP_auth_error(sock, GT_("Bad base64 reply from server.\n"));
return;
}
- to64frombits(b64buf, username, strlen(username));
+ to64frombits(b64buf, username, strlen(username), sizeof b64buf);
SockPrintf(sock, "%s\r\n", b64buf);
SockRead(sock, smtp_response, sizeof(smtp_response) - 1);
strlcpy(tmp, smtp_response, sizeof(tmp));
@@ -159,7 +159,7 @@ static void SMTP_auth(int sock, char smtp_mode, char *username, char *password,
SMTP_auth_error(sock, GT_("Bad base64 reply from server.\n"));
return;
}
- to64frombits(b64buf, password, strlen(password));
+ to64frombits(b64buf, password, strlen(password), sizeof b64buf);
SockPrintf(sock, "%s\r\n", b64buf);
SMTP_ok(sock, smtp_mode, TIMEOUT_DEFAULT);
}