wmbiff: replaced strncpy with memcpy.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
This commit is contained in:
Jeremy Sowden 2019-07-02 20:53:42 +01:00 committed by Carlos R. Mafra
parent b055b12fa5
commit ecca3b3b45

View file

@ -74,15 +74,12 @@ struct connection_state *pop3Login(Pop3 *pc)
{ {
int fd; int fd;
char buf[BUF_SIZE]; char buf[BUF_SIZE];
char apop_str[BUF_SIZE]; char apop_str[BUF_SIZE] = "";
char *ptr1, *ptr2; char *ptr1, *ptr2;
struct authentication_method *a; struct authentication_method *a;
struct connection_state *scs; struct connection_state *scs;
char *connection_name; char *connection_name;
apop_str[0] = '\0'; /* if defined, server supports apop */
if ((fd = sock_connect(PCU.serverName, PCU.serverPort)) == -1) { if ((fd = sock_connect(PCU.serverName, PCU.serverPort)) == -1) {
POP_DM(pc, DEBUG_ERROR, "Not Connected To Server '%s:%d'\n", POP_DM(pc, DEBUG_ERROR, "Not Connected To Server '%s:%d'\n",
PCU.serverName, PCU.serverPort); PCU.serverName, PCU.serverPort);
@ -111,14 +108,12 @@ struct connection_state *pop3Login(Pop3 *pc)
ptr2 = ptr1; ptr2 = ptr1;
} else if (*ptr1 == '<') { } else if (*ptr1 == '<') {
if (ptr2) { if (ptr2) {
*(ptr2 + 1) = 0; memcpy(apop_str, ptr1, 1 + ptr2 - ptr1);
strncpy(apop_str, ptr1, BUF_SIZE);
} }
break; break;
} }
} }
/* try each authentication method in turn. */ /* try each authentication method in turn. */
for (a = auth_methods; a->name != NULL; a++) { for (a = auth_methods; a->name != NULL; a++) {
/* was it specified or did the user leave it up to us? */ /* was it specified or did the user leave it up to us? */