mirror of
https://abf.rosa.ru/djam/glibc.git
synced 2025-02-23 23:12:48 +00:00
37 lines
1.3 KiB
Diff
37 lines
1.3 KiB
Diff
https://sourceware.org/git/?p=glibc.git;a=commitdiff_plain;h=226b46770c82899b555986583294b049c6ec9b40
|
|
From: Florian Weimer <fweimer@redhat.com>
|
|
Date: Mon, 17 Jan 2022 09:21:34 +0000 (+0100)
|
|
Subject: CVE-2022-23219: Buffer overflow in sunrpc clnt_create for "unix" (bug 22542)
|
|
X-Git-Tag: glibc-2.35~70
|
|
X-Git-Url: https://sourceware.org/git/?p=glibc.git;a=commitdiff_plain;h=226b46770c82899b555986583294b049c6ec9b40
|
|
|
|
CVE-2022-23219: Buffer overflow in sunrpc clnt_create for "unix" (bug 22542)
|
|
|
|
Processing an overlong pathname in the sunrpc clnt_create function
|
|
results in a stack-based buffer overflow.
|
|
|
|
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
|
---
|
|
|
|
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)
|
|
|