mirror of
https://repo.or.cz/socat.git
synced 2024-12-22 15:32:35 +00:00
unnamed unix domain socket could generate invalid log output or lead to a process crash
This commit is contained in:
parent
b8d16ecd51
commit
3881c794a7
2 changed files with 13 additions and 5 deletions
4
CHANGES
4
CHANGES
|
@ -26,6 +26,10 @@ corrections:
|
|||
address PTY does not take any parameters but did not report an error
|
||||
when some were given
|
||||
|
||||
Marcus Meissner provided a patch that fixes invalid output and possible
|
||||
process crash when socat prints info about an unnamed unix domain
|
||||
socket
|
||||
|
||||
####################### V 1.7.1.3:
|
||||
|
||||
security:
|
||||
|
|
14
sysutils.c
14
sysutils.c
|
@ -1,5 +1,5 @@
|
|||
/* source: sysutils.c */
|
||||
/* Copyright Gerhard Rieger 2001-2008 */
|
||||
/* Copyright Gerhard Rieger 2001-2011 */
|
||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||
|
||||
/* translate socket addresses into human readable form */
|
||||
|
@ -215,10 +215,14 @@ char *sockaddr_unix_info(const struct sockaddr_un *sa, socklen_t salen, char *bu
|
|||
} else
|
||||
#endif /* WITH_ABSTRACT_UNIXSOCKET */
|
||||
{
|
||||
nextc =
|
||||
sanitize_string(sa->sun_path,
|
||||
MIN(UNIX_PATH_MAX, strlen(sa->sun_path)),
|
||||
ubuff, XIOSAN_DEFAULT_BACKSLASH_OCT_3);
|
||||
if (salen <= XIOUNIXSOCKOVERHEAD) {
|
||||
nextc = sanitize_string ("<anon>", MIN(UNIX_PATH_MAX, strlen("<anon>")),
|
||||
ubuff, XIOSAN_DEFAULT_BACKSLASH_OCT_3);
|
||||
} else {
|
||||
nextc = sanitize_string(sa->sun_path,
|
||||
MIN(UNIX_PATH_MAX, strlen(sa->sun_path)),
|
||||
ubuff, XIOSAN_DEFAULT_BACKSLASH_OCT_3);
|
||||
}
|
||||
*nextc = '\0';
|
||||
strncpy(buff, ubuff, blen);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue