]> git.ipfire.org Git - thirdparty/glibc.git/commit
gshadow: Matching sgetsgent, sgetsgent_r ERANGE handling (bug 30151)
authorFlorian Weimer <fweimer@redhat.com>
Tue, 21 Feb 2023 08:20:28 +0000 (09:20 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Mon, 24 Apr 2023 12:36:55 +0000 (14:36 +0200)
commit8d07e65d15450ea86767fa402579b874cca6f9bc
treeb8c3f14a03931535928de43c7c1126bdb95b33c8
parentb7cc55a24ea303875d95d0db3f73f9239bba2583
gshadow: Matching sgetsgent, sgetsgent_r ERANGE handling (bug 30151)

Before this change, sgetsgent_r did not set errno to ERANGE, but
sgetsgent only check errno, not the return value from sgetsgent_r.
Consequently, sgetsgent did not detect any error, and reported
success to the caller, without initializing the struct sgrp object
whose address was returned.

This commit changes sgetsgent_r to set errno as well.  This avoids
similar issues in applications which only change errno.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
(cherry picked from commit 969e9733c7d17edf1e239a73fa172f357561f440)
NEWS
gshadow/Makefile
gshadow/sgetsgent_r.c
gshadow/tst-sgetsgent.c [new file with mode: 0644]