diff options
author | 2001-07-26 23:27:10 +0000 | |
---|---|---|
committer | 2001-07-26 23:27:10 +0000 | |
commit | 2e7897495782bf04835cf18c52dbcfec3fcfe61e (patch) | |
tree | 84cf1d2449e5e61af0b1267bb9ce8b2143fbc334 /chpass/pw_copy.c | |
parent | ff4aa702015e5d6b3863c90eba93e78bb2e26a23 (diff) | |
download | pw-darwin-2e7897495782bf04835cf18c52dbcfec3fcfe61e.tar.gz pw-darwin-2e7897495782bf04835cf18c52dbcfec3fcfe61e.tar.zst pw-darwin-2e7897495782bf04835cf18c52dbcfec3fcfe61e.zip |
Prevent chpass(1) from writing -1 in the UID or GID fields
in the password file by properly casting integers.
PR: 27757
Reviewed by: des
Approved by: des
MFC after: 4 days
Diffstat (limited to 'chpass/pw_copy.c')
-rw-r--r-- | chpass/pw_copy.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/chpass/pw_copy.c b/chpass/pw_copy.c index 5d5a7de..d475757 100644 --- a/chpass/pw_copy.c +++ b/chpass/pw_copy.c @@ -29,6 +29,8 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * $FreeBSD$ */ #ifndef lint @@ -64,8 +66,8 @@ pw_copy(ffd, tfd, pw) char chgstr[20]; char expstr[20]; - snprintf(uidstr, sizeof(uidstr), "%d", pw->pw_uid); - snprintf(gidstr, sizeof(gidstr), "%d", pw->pw_gid); + snprintf(uidstr, sizeof(uidstr), "%lu", (unsigned long)pw->pw_uid); + snprintf(gidstr, sizeof(gidstr), "%lu", (unsigned long)pw->pw_gid); snprintf(chgstr, sizeof(chgstr), "%ld", (long)pw->pw_change); snprintf(expstr, sizeof(expstr), "%ld", (long)pw->pw_expire); |