Linux ld.so patch

Alex Belits (abelits@PHOBOS.ILLTEL.DENVER.CO.US)
Mon, 21 Jul 1997 02:01:48 -0700

This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.

--Boundary_(ID_uPqRg3Urjv21syCKnvgrWw)
Content-type: TEXT/PLAIN; charset=US-ASCII

On Fri, 18 Jul 1997, KSR[T] wrote:

> Our advisory contained one serious piece of mis-information. The latest
> version of ld.so that we tested (1.9.2) still appeared to be
> vulnerable to this overflow.
>
> We strongly recommend that anyone running linux install the patch
> distributed with the advisory, or wait for your vendor to release
> an updated ld.so package and install that as soon as possible.
>
> The patch is available from our web site (http://www.dec.net/ksrt).
>
> We apologize for any confusion this might have caused.
>

Since other overflows were found in ld.so of both elf and a.out, I've
made a patch that converts vsprintf() into vsnprintf() and included fixed
version of the original patch and suggested fix about 11-th item in
libraries list. The patch is against ld.so 1.9.2 distribution.

--
Alex

--Boundary_(ID_uPqRg3Urjv21syCKnvgrWw) Content-id: <Pine.LNX.3.95.970721020148.3243C@phobos.illtel.denver.co.us> Content-type: TEXT/PLAIN; name=ld-fix; charset=US-ASCII Content-description: ld.so 1.9.2 fix Content-disposition: ATTACHMENT; FILENAME=ld-fix Content-transfer-encoding: BASE64

ZGlmZiAtcnUgbGQuc28tMS45LjIvQ29uZmlnLm1rIGxkLnNvLTEuOS4yLWZp eGVkL0NvbmZpZy5taw0KLS0tIGxkLnNvLTEuOS4yL0NvbmZpZy5tawlUdWUg TWFyIDE4IDE4OjQxOjA4IDE5OTcNCisrKyBsZC5zby0xLjkuMi1maXhlZC9D b25maWcubWsJRnJpIEp1bCAxOCAwMTowOTo0MyAxOTk3DQpAQCAtMiw3ICsy LDcgQEANCiAjQVJDSCA9IG02OGsNCiAjQVJDSCA9IHNwYXJjDQogI0RFQlVH ID0gdHJ1ZQ0KLSNBT1VUX1NVUFBPUlQgPSB0cnVlDQorQU9VVF9TVVBQT1JU ID0gdHJ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