Anonymous | Login | 2021-04-21 05:05 UTC |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||||||
ID | Category | Severity | Type | Date Submitted | Last Update | |||||||
0001219 | [1003.1(2008)/Issue 7] System Interfaces | Objection | Error | 2018-12-12 17:29 | 2018-12-12 21:06 | |||||||
Reporter | sebor | View Status | public | |||||||||
Assigned To | ajosey | |||||||||||
Priority | normal | Resolution | Open | |||||||||
Status | Under Review | |||||||||||
Name | Martin Sebor | |||||||||||
Organization | ||||||||||||
User Reference | ||||||||||||
Section | snprintf | |||||||||||
Page Number | 906 | |||||||||||
Line Number | 30447 | |||||||||||
Interp Status | --- | |||||||||||
Final Accepted Text | ||||||||||||
Summary | 0001219: snprintf reequirement to fail when n > INT_MAX conflicts with C | |||||||||||
Description |
The snprintf description states that: The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the requirements described here and the ISO C standard is unintentional. This volume of POSIX.1-2008 defers to the ISO C standard. and The snprintf() function shall fail if: [CX][EOVERFLOW] The value of n is greater than {INT_MAX}. The requirement conflicts with C. C requires snprintf to succeed regardless of the value of n provided it outputs fewer than INT_MAX bytes. The POSIX requirement prevents implementations from conforming to the C requirement. For example, the following strictly conforming C snippet must not trigger the assertion: char d[1]; int n = snprintf (d, (size_t)INT_MAX + 1, ""); assert (n == 0); while in POSIX the assertion is required to fail. |
|||||||||||
Desired Action | Remove the requirement for snprintf to fail when n > INT_MAX. Same for other variants of the function, such as vsnprintf. | |||||||||||
Tags | No tags attached. | |||||||||||
Attached Files | ||||||||||||
|
![]() |
|||||||
|
Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group |