Project

General

Profile

Actions

Bug #11710

open

custr_append_printf() uses ap twice

Added by Jason King about 4 years ago.

Status:
New
Priority:
Normal
Assignee:
Category:
lib - userland libraries
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
External Bug:

Description

custr_append_vprintf has the following bits of code:

        int len = vsnprintf(NULL, 0, fmt, ap);
...
        /*
         * Append new string to existing string:
         */
        if ((len = vsnprintf(cus->cus_data + cus->cus_strlen,
            cus->cus_datalen - cus->cus_strlen, fmt, ap)) < 0) {
                return (len);
        }

While this seems to work, this almost certainly feels wrong -- ap should be copied prior to the first call to vsnprintf(3C), and one of the invocations of vsnprintf(3C ) should use the copy while the other uses ap

No data to display

Actions

Also available in: Atom PDF