apr-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 39996] New: - apr_(v)snprintf wrong return value
Date Sun, 09 Jul 2006 22:38:36 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39996>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39996

           Summary: apr_(v)snprintf wrong return value
           Product: APR
           Version: 1.2.7
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: APR
        AssignedTo: bugs@apr.apache.org
        ReportedBy: regenrecht@o2.pl
                CC: rooneg@electricjellyfish.net


apr_(v)snprintf from strings/apr_snprintf.c (according to apr_strings.h)
should return "the number of characters inserted into the buffer, not
including the terminating NUL". But, as for APR 1.2.7 (Arch Linux build),
that's not true if length of input string >= buffer limit. In that case
NUL byte is counted as well.

This code:

    char buff[8];
    printf("%d", apr_snprintf(buff, 8, "12345678"));

will return '8' instead of '7'.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

Mime
View raw message