aboutsummaryrefslogtreecommitdiffstats
path: root/main/musl/0050-fix-regression-in-getspnam-_r-error-code-for-insuffi.patch
blob: cc11a81ce1dc76b8cbb4c89e58d9087928779365 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
From 91d34c4533e6bf6eacad7a9f001f28f9e5ebc656 Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
Date: Wed, 21 Jun 2017 19:06:45 -0400
Subject: [PATCH 50/50] fix regression in getspnam[_r] error code for
 insufficient buffer size

commit 2d7d05f031e014068a61d3076c6178513395d2ae wrongly changed ERANGE
to EINVAL, likely as the result of copy-and-paste error.
---
 src/passwd/getspnam_r.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/passwd/getspnam_r.c b/src/passwd/getspnam_r.c
index e488b67f..541206fa 100644
--- a/src/passwd/getspnam_r.c
+++ b/src/passwd/getspnam_r.c
@@ -76,7 +76,7 @@ int getspnam_r(const char *name, struct spwd *sp, char *buf, size_t size, struct
 
 	/* Buffer size must at least be able to hold name, plus some.. */
 	if (size < l+100)
-		return errno = EINVAL;
+		return errno = ERANGE;
 
 	/* Protect against truncation */
 	if (snprintf(path, sizeof path, "/etc/tcb/%s/shadow", name) >= sizeof path)
-- 
2.13.1