Module Name: src Committed By: gson Date: Tue Dec 7 10:39:33 UTC 2021
Modified Files: src/lib/librumpuser: sp_common.c Log Message: In unix_parse(), always allocate memory for the entire struct sockaddr_un and not just the part used by the present pathname, because the entire struct will be passed to bind() and an EFAULT can result if not all of it is a valid allocation. Fixes PR kern/56533. To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/lib/librumpuser/sp_common.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/librumpuser/sp_common.c diff -u src/lib/librumpuser/sp_common.c:1.42 src/lib/librumpuser/sp_common.c:1.43 --- src/lib/librumpuser/sp_common.c:1.42 Sat Jun 13 16:51:59 2020 +++ src/lib/librumpuser/sp_common.c Tue Dec 7 10:39:33 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: sp_common.c,v 1.42 2020/06/13 16:51:59 kamil Exp $ */ +/* $NetBSD: sp_common.c,v 1.43 2021/12/07 10:39:33 gson Exp $ */ /* * Copyright (c) 2010, 2011 Antti Kantee. All Rights Reserved. @@ -670,12 +670,10 @@ unix_parse(const char *addr, struct sock } } strcat(s_un.sun_path, addr); -#if defined(__linux__) || defined(__sun__) || defined(__CYGWIN__) - slen = sizeof(s_un); -#else +#if !(defined(__linux__) || defined(__sun__) || defined(__CYGWIN__)) s_un.sun_len = SUN_LEN(&s_un); - slen = s_un.sun_len+1; /* get the 0 too */ #endif + slen = sizeof(s_un); if (savepath && *parsedurl == '\0') { snprintf(parsedurl, sizeof(parsedurl),