wmbiff: fixed endianness problems parsing server-ports.
`regulo_atoi` expects a pointer-to-int and `PCU.serverPort` is a `uint16_t`, so `&PCU.serverPort` is not compatible and we need to use an `int` temporary variable to avoid endianness problems. Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
This commit is contained in:
parent
d0345f1059
commit
897886a68c
1 changed files with 10 additions and 2 deletions
|
@ -501,13 +501,19 @@ int imap4Create( /*@notnull@ */ Pop3 pc, const char *const str)
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
char *unaliased_str;
|
char *unaliased_str;
|
||||||
|
/*
|
||||||
|
* regulo_atoi expects a pointer-to-int and pop_imap.serverPort is a
|
||||||
|
* uint16_t, so &pop_imap.serverPort is not compatible and we need to use an
|
||||||
|
* int temporary variable to avoid endianness problems.
|
||||||
|
*/
|
||||||
|
int serverPort;
|
||||||
|
|
||||||
struct regulo regulos[] = {
|
struct regulo regulos[] = {
|
||||||
{1, PCU.userName, regulo_strcpy},
|
{1, PCU.userName, regulo_strcpy},
|
||||||
{2, PCU.password, regulo_strcpy},
|
{2, PCU.password, regulo_strcpy},
|
||||||
{3, PCU.serverName, regulo_strcpy},
|
{3, PCU.serverName, regulo_strcpy},
|
||||||
{4, pc->path, regulo_strcpy_skip1},
|
{4, pc->path, regulo_strcpy_skip1},
|
||||||
{7, &PCU.serverPort, regulo_atoi},
|
{7, &serverPort, regulo_atoi},
|
||||||
{9, PCU.authList, regulo_strcpy_tolower},
|
{9, PCU.authList, regulo_strcpy_tolower},
|
||||||
{0, NULL, NULL}
|
{0, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
@ -536,7 +542,7 @@ int imap4Create( /*@notnull@ */ Pop3 pc, const char *const str)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* defaults */
|
/* defaults */
|
||||||
PCU.serverPort = (PCU.dossl != 0) ? 993 : 143;
|
serverPort = (PCU.dossl != 0) ? 993 : 143;
|
||||||
PCU.authList[0] = '\0';
|
PCU.authList[0] = '\0';
|
||||||
|
|
||||||
/* argh, str and pc->path are aliases, so we can't just write the default
|
/* argh, str and pc->path are aliases, so we can't just write the default
|
||||||
|
@ -559,6 +565,8 @@ int imap4Create( /*@notnull@ */ Pop3 pc, const char *const str)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PCU.serverPort = serverPort;
|
||||||
|
|
||||||
PCU.password_len = strlen(PCU.password);
|
PCU.password_len = strlen(PCU.password);
|
||||||
if (PCU.password[0] == '\0') {
|
if (PCU.password[0] == '\0') {
|
||||||
PCU.interactive_password = 1;
|
PCU.interactive_password = 1;
|
||||||
|
|
Loading…
Reference in a new issue