read_alias_line discards every second entry
Thorsten Kukuk
kukuk@suse.de
Wed Jun 18 08:19:00 GMT 2003
Hi,
the read_alias_file() function in intl/localealias.c discards every
second entry. The reason is the following code:
/* Possibly not the whole line fits into the buffer. Ignore
the rest of the line. */
while (strchr (buf, '\n') == NULL)
if (FGETS (buf, sizeof buf, fp) == NULL)
/* Make sure the inner loop will be left. The outer loop
will exit at the `feof' test. */
break;
We write two '\0' into "buf" before we execute this code, one after
every token. So buf contains something like: "alias\0\tvalue\0\n".
strchr will always exit after the first '\0' and always reads the
next line of the file. So every second entry is ignored.
This was changed between glibc 2.2 and 2.3 with the following
changelog:
2002-11-19 Ulrich Drepper <drepper@redhat.com>
* intl/localealias.c (read_alias_file): Use only about 400 bytes
of stack space instead of 16k.
Thorsten
--
Thorsten Kukuk http://www.suse.de/~kukuk/ kukuk@suse.de
SuSE Linux AG Deutschherrnstr. 15-19 D-90429 Nuernberg
--------------------------------------------------------------------
Key fingerprint = A368 676B 5E1B 3E46 CFCE 2D97 F8FD 4E23 56C6 FB4B
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20030618/edde0744/attachment.sig>
More information about the Libc-alpha
mailing list