Skip to content
This repository was archived by the owner on May 27, 2021. It is now read-only.
This repository was archived by the owner on May 27, 2021. It is now read-only.

vpline() fails to detect repeated lines properly #32

Description

@tung

From libnitrohack/src/pline.c line 29 (emphasis mine):

static void vpline(const char *line, va_list the_args)
{
    char pbuf[BUFSZ];

    if (!line || !*line) return;
    if (strchr(line, '%')) {
        vsprintf(pbuf,line,the_args);
        line = pbuf;
    }
    if (no_repeat && !strcmp(line, toplines[curline])) /* <<< 1 */
        return;
    if (vision_full_recalc)
        vision_recalc(0);
    if (u.ux)
        flush_screen();

    strcpy(toplines[curline++], line); /* <<< 2 */
    curline %= MSGCOUNT;
    print_message(moves, line);
}

The line marked 2 always sets curline to the next position in toplines[] to be used, which makes the check at the line marked 1 incorrectly do a string comparison one ahead of the line it should check. This causes Norep() to fail to detect repeated lines when it should.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions