From: Michal Jaegermann <michal@ellpspace.math.ualberta.ca>
To: bugs@redhat.com
Cc: axp-list@redhat.com
Subject: Memory allocation bug in 'who'
Date: Mon, 25 May 1998 15:47:39 -0600 (MDT) [thread overview]
Message-ID: <199805252147.PAA02261@ellpspace.math.ualberta.ca> (raw)
There is a minor bug in 'who' from sh-utils. In fact it does not
exist in original sh-utils from GNU and it was introduced by
sh-utils-1.16-getutent.patch distributed by Red Hat.
The problem is that while reading utmp entries a test when
to reallocate was reversed and we do not do that **exactly**
only when it is needed. In right circumstances this leads to
bizzare errors like "Memory exhausted" or "Segmenation violation"
and the like.
This correction fixes the problem:
--- sh-utils-1.16/src/who.c~ Mon May 25 14:22:24 1998
+++ sh-utils-1.16/src/who.c Mon May 25 14:42:37 1998
@@ -534,7 +534,7 @@
while ((uptr=getutent())) {
memcpy(&utmp_contents[n_read], uptr, sizeof(STRUCT_UTMP));
n_read++;
- if ( n_read % UTMP_READ_INCR )
+ if (0 == ( n_read % UTMP_READ_INCR ))
xrealloc(utmp_contents,((n_read / UTMP_READ_INCR)+1)*
UTMP_READ_INCR*sizeof(STRUCT_UTMP));
}
It should be applied only if "getutent.patch" was used. It will
fail for a straight GNU version.
Michal
michal@harddata.com
michal@ellpspace.math.ualberta.ca
reply other threads:[~1998-05-25 21:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox