[net.unix-wizards] ar bug

salkind%nyu@sri-unix.UUCP (02/10/84)

From:  Lou Salkind <salkind@nyu>

Subject: ar bug
Index:	bin/ar.c 4.2BSD

Description:
	If you try to archive a file with a uid or gid greater than
	32K, ar will fail when you try to read the archive back in.
	You will get the message "Malformed archive."
Repeat-By:
	mkdir f
	chgrp 50000 f
	cd f
	cp /etc/passwd f
	ar r f.a passwd
	ar t f.a
Fix:
	When the file header is written out, cast the uid and gid to an
	unsigned short.  "diff ar.c.dist ar.c" follows:
510,511c510,511
< 	   stbuf.st_uid,
< 	   stbuf.st_gid,
---
> 	   (u_short)stbuf.st_uid,
> 	   (u_short)stbuf.st_gid,