emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fformat fails to detect premature end of string


From: Johan Bockgård
Subject: Fformat fails to detect premature end of string
Date: Mon, 19 Sep 2005 01:19:50 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

(format "%" 0)
 => Invalid format operation %j (where "j" is some random garbage)


The problem is this code in Fformat [editfns.c:3427]:

    while (index ("-0# ", *format))
      ++format;

which is executed before the `if (format == end)' test.

The man page for `index' says

    "The index() function returns a pointer to the first occurrence of
    the character c in the string s. [...] The terminating NULL
    character is considered to be a part of the strings."

So when *format is '\0' the pointer will be incremented past the end
of the string.

-- 
Johan Bockgård




reply via email to

[Prev in Thread] Current Thread [Next in Thread]