New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CID 393: STRING_OVERFLOW in kick_mupdate #1437

Closed
brong opened this Issue Aug 29, 2011 · 1 comment

Comments

Projects
None yet
2 participants
@brong
Contributor

brong commented Aug 29, 2011

From: Greg Banks
Bugzilla-Id: 3542
Version: 2.4.x (next)
Owner: Bron Gondwana

@brong

This comment has been minimized.

Show comment
Hide comment
@brong

brong Aug 29, 2011

Contributor

From: Greg Banks

Found by Coverity. kick_mupdate() builds a struct sockaddr_un using a string from the imapd.conf, placing an effective limit of 86 chars on the value of the 'configdirectory' option but not enforcing it properly.

647 char buf[2048];
648 struct sockaddr_un srvaddr;
...
658 strlcpy(buf, config_dir, sizeof(buf));
659 strlcat(buf, FNAME_MUPDATE_TARGET_SOCK, sizeof(buf));
660 memset((char *)&srvaddr, 0, sizeof(srvaddr));
661 srvaddr.sun_family = AF_UNIX;
Event string_overflow: You might overrun the 108 byte destination string "srvaddr.sun_path" by writing 2048 bytes from "buf".
662 strcpy(srvaddr.sun_path, buf);
663 len = sizeof(srvaddr.sun_family) + strlen(srvaddr.sun_path) + 1;
664
665 r = connect(s, (struct sockaddr *)&srvaddr, len);

and

#define FNAME_MUPDATE_TARGET_SOCK "/socket/mupdate.target"

Contributor

brong commented Aug 29, 2011

From: Greg Banks

Found by Coverity. kick_mupdate() builds a struct sockaddr_un using a string from the imapd.conf, placing an effective limit of 86 chars on the value of the 'configdirectory' option but not enforcing it properly.

647 char buf[2048];
648 struct sockaddr_un srvaddr;
...
658 strlcpy(buf, config_dir, sizeof(buf));
659 strlcat(buf, FNAME_MUPDATE_TARGET_SOCK, sizeof(buf));
660 memset((char *)&srvaddr, 0, sizeof(srvaddr));
661 srvaddr.sun_family = AF_UNIX;
Event string_overflow: You might overrun the 108 byte destination string "srvaddr.sun_path" by writing 2048 bytes from "buf".
662 strcpy(srvaddr.sun_path, buf);
663 len = sizeof(srvaddr.sun_family) + strlen(srvaddr.sun_path) + 1;
664
665 r = connect(s, (struct sockaddr *)&srvaddr, len);

and

#define FNAME_MUPDATE_TARGET_SOCK "/socket/mupdate.target"

@brong brong added IMAP P5 bug labels Dec 13, 2016

@brong brong self-assigned this Dec 13, 2016

@elliefm elliefm assigned elliefm and unassigned brong Aug 7, 2017

@elliefm elliefm closed this in 6d8c95e Aug 7, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment