Merge pull request #278 from loomy/master

lmtp on local socket: fix socketpath checks
merge-experiment
Hoà V. DINH 2017-08-14 11:40:35 -07:00 committed by GitHub
commit cc670add8e
1 changed files with 5 additions and 1 deletions

View File

@ -190,7 +190,11 @@ int mail_unix_connect_socket(const char *path)
struct sockaddr_un sa;
int s;
if (!(memcpy(sa.sun_path, path, strlen(path)))) {
if (sizeof(sa.sun_path) <= strlen(path)) {
return -1;
}
if (!(memcpy(sa.sun_path, path, sizeof(sa.sun_path)))) {
return -1;
}
sa.sun_family = AF_UNIX;