diff --git a/NEWS b/NEWS index 759a80b1b5..1b8c871de1 100644 --- a/NEWS +++ b/NEWS @@ -7,10 +7,17 @@ using `glibc' in the "product" field. Version 2.34.1 +Security related changes: + + CVE-2022-23219: Passing an overlong file name to the clnt_create + legacy function could result in a stack-based buffer overflow when + using the "unix" protocol. Reported by Martin Sebor. + The following bugs are resolved with this release: [12889] nptl: Fix race between pthread_kill and thread exit [19193] nptl: pthread_kill, pthread_cancel should not fail after exit + [22542] CVE-2022-23219: Buffer overflow in sunrpc clnt_create for "unix" [28036] Incorrect types for pthread_mutexattr_set/getrobust_np [28182] _TIME_BITS=64 in C++ has issues with fcntl, ioctl, prctl [28223] mips: clone does not align stack diff --git a/sunrpc/clnt_gen.c b/sunrpc/clnt_gen.c index 13ced8994e..b44357cd88 100644 --- a/sunrpc/clnt_gen.c +++ b/sunrpc/clnt_gen.c @@ -57,9 +57,13 @@ clnt_create (const char *hostname, u_long prog, u_long vers, if (strcmp (proto, "unix") == 0) { - memset ((char *)&sun, 0, sizeof (sun)); - sun.sun_family = AF_UNIX; - strcpy (sun.sun_path, hostname); + if (__sockaddr_un_set (&sun, hostname) < 0) + { + struct rpc_createerr *ce = &get_rpc_createerr (); + ce->cf_stat = RPC_SYSTEMERROR; + ce->cf_error.re_errno = errno; + return NULL; + } sock = RPC_ANYSOCK; client = clntunix_create (&sun, prog, vers, &sock, 0, 0); if (client == NULL)