Austin Group Defect Tracker

Aardvark Mark IV


Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0001397 [1003.1(2008)/Issue 7] System Interfaces Objection Error 2020-08-30 20:53 2020-09-01 08:31
Reporter sebor View Status public  
Assigned To ajosey
Priority normal Resolution Open  
Status Under Review  
Name Martin Sebor
Organization
User Reference
Section strndup
Page Number unknown
Line Number unknown
Interp Status ---
Final Accepted Text
Summary 0001397: strndup incorrectly implies argument must be a string
Description Because it doesn't make use of the term array, and because it refers to "the length of s," the specification for strndup() suggests the s argument is required to be a nul-terminated string rather than an arbitrary array of characters. However, the canonical implementation of the function is to call strnlen() with the size argument as the bound to determine the number of characters to copy (see also APPLICATION USAGE). Thus the function accepts as the first argument an array that need not be a nul-terminated string.
Desired Action Correct strndup() to make it explicit that s doesn't have to point to a nul-terminated string, e.g., like so:

The strndup() function shall be equivalent to the strdup() function, duplicating the <ins>smaller of the number of bytes in the array to which s points, not including any terminating NUL character, or the value of the maxlen argument, </ins><del>provided s</del> in a new block of memory allocated as if by using malloc(), ...
Tags No tags attached.
Attached Files

- Relationships
duplicate of 0001019Applied 1003.1(2013)/Issue7+TC1 strndup shouldn't require source array to be null-terminated 

-  Notes
(0004963)
geoffclare (manager)
2020-09-01 08:31

This should be closed as a duplicate of bug 0001019.

- Issue History
Date Modified Username Field Change
2020-08-30 20:53 sebor New Issue
2020-08-30 20:53 sebor Status New => Under Review
2020-08-30 20:53 sebor Assigned To => ajosey
2020-08-30 20:53 sebor Name => Martin Sebor
2020-08-30 20:53 sebor Section => strndup
2020-08-30 20:53 sebor Page Number => unknown
2020-08-30 20:53 sebor Line Number => unknown
2020-09-01 08:31 geoffclare Note Added: 0004963
2020-09-01 08:31 geoffclare Relationship added duplicate of 0001019


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker