The following issue has been UPDATED.
======================================================================
http://austingroupbugs.net/view.php?id=75
======================================================================
Reported By: geoffclare
Assigned To: ajosey
======================================================================
Project: 1003.1(2008)/Issue 7
Issue ID: 75
Category: System Interfaces
Type: Error
Severity: Objection
Priority: normal
Status: Resolved
Name: Geoff Clare
Organization:
User Reference:
Section: basename
Page Number: 614
Line Number: 20984
Final Accepted Text:
Resolution: Accepted
Fixed in Version:
======================================================================
Date Submitted: 2009-06-29 02:32 UTC
Last Modified: 2009-07-01 14:03 UTC
======================================================================
Summary: functions that are allowed to overwrite returned
static data
Description:
_____________________________________________________________________________
OBJECTION Enhancement Request
Number 12
gwc:xxxxxxxxxxxxx Bug in XSHd5.1 basename (rdvk#
2)
[gwc static data] Tue, 28 Oct 2008 12:12:45
+0000
_____________________________________________________________________________
The issue identified for setlocale() in aardvark XSH ERN 250 against
the 2004 edition of the standard also affects several other functions.
These are functions that are allowed to overwrite returned static data,
but should also be allowed to use an internally reallocated buffer for
the data.
In some cases the statement that returned data may be overwritten is
in APPLICATION USAGE. In these cases the proposed replacement is in
normative text.
Desired Action:
[Page and line numbers are for draft 5.1.]
basename: P614 L20984
Change
"The basename() function may modify the string pointed to by
path, and may return a pointer to static storage that may then be
overwritten by a subsequent call to basename()."
to
"The basename() function may modify the string pointed to by
path, and may return a pointer to internal storage.
The returned pointer might be invalidated or the storage
might be overwritten by a subsequent call to basename()."
ctermid: P713 L24020
Change
"If s is a null pointer, the string shall be generated in an area
that may be static (and therefore may be overwritten by each call),
the address of which shall be returned. Otherwise, ..."
to
"If s is a null pointer, the string shall be generated in a area
that may be static, the address of which shall be returned. The
application shall not modify the string returned. The returned
pointer might be invalidated or the string content might be
overwritten by a subsequent call to ctermid(). If s is not a
null pointer, ..."
dirname: P725 L24385
Change
"The dirname() function may modify the string pointed to by path,
and may return a pointer to static storage that may then be
overwritten by subsequent calls to dirname()."
to
"The dirname() function may modify the string pointed to by path,
and may return a pointer to internal storage. The returned
pointer might be invalidated or the storage might be overwritten
by a subsequent call to dirname()."
dlerror: P730 L24547
Add a new paragraph to the RETURN VALUE section:
"The application shall not modify the string returned. The
returned pointer might be invalidated or the string content might
be overwritten by a subsequent call to dlerror()."
dlerror: P730 L24560
Delete
"The messages returned by dlerror() may reside in a static buffer
that is overwritten on each call to dlerror(). Application code
should not write to this buffer. Programs wishing to preserve an
error message should make their own copies of that message."
getgrent: P747 L25066 section endgrent
Change
"The return value may point to a static area which is overwritten
by a subsequent call to getgrgid(), getgrnam(), or getgrent()."
to
"The application shall not modify the structure to which the
return value points, nor any storage areas pointed to by pointers
within the structure. The returned pointer, and pointers within
the structure, might be invalidated or the structure or the storage
areas might be overwritten by a subsequent call to getgrgid(),
getgrnam(), or getgrent()."
gethostent: P749 L25126 section endhostent
Add a new paragraph to the RETURN VALUE section:
"The application shall not modify the structure to which the
return value points, nor any storage areas pointed to by pointers
within the structure. The returned pointer, and pointers within
the structure, might be invalidated or the structure or the storage
areas might be overwritten by a subsequent call to gethostent()."
gethostent: P749 L25132 section endhostent
Change
"The gethostent() function may return pointers to static data,
which may be overwritten by subsequent calls to any of these
functions."
to
"None"
getnet*: P751 L25180 section endnetent
Add a new paragraph to the RETURN VALUE section:
"The application shall not modify the structure to which the
return value points, nor any storage areas pointed to by pointers
within the structure. The returned pointer, and pointers within
the structure, might be invalidated or the structure or the storage
areas might be overwritten by a subsequent call to getnetbyaddr(),
getnetbyname(), or getnetent()."
getnet*: P752 L25186 section endnetent
Change
"The getnetbyaddr(), getnetbyname(), and getnetent() functions may
return pointers to static data, which may be overwritten by
subsequent calls to any of these functions."
to
"None"
getproto*: P753 L25235 section endprotoent
Add a new paragraph to the RETURN VALUE section:
"The application shall not modify the structure to which the
return value points, nor any storage areas pointed to by pointers
within the structure. The returned pointer, and pointers within
the structure, might be invalidated or the structure or the storage
areas might be overwritten by a subsequent call to getprotobyname(),
getprotobynumber(), or getprotoent()."
getproto*: P754 L25241 section endprotoent
Change
"The getprotobyname(), getprotobynumber(), and getprotoent()
functions may return pointers to static data, which may be
overwritten by subsequent calls to any of these functions."
to
"None"
getpwent: P755 L25276 section endpwent
Add a new paragraph to the RETURN VALUE section:
"The application shall not modify the structure to which the
return value points, nor any storage areas pointed to by pointers
within the structure. The returned pointer, and pointers within
the structure, might be invalidated or the structure or the storage
areas might be overwritten by a subsequent call to getpwuid(),
getpwnam(), or getpwent()."
getpwent: P755 L25283 section endpwent
Delete from the ERRORS section:
"The return value may point to a static area which is overwritten
by a subsequent call to getpwuid(), getpwnam(), or getpwent()."
getserv*: P758 L25367 section endservent
Add a new paragraph to the RETURN VALUE section:
"The application shall not modify the structure to which the
return value points, nor any storage areas pointed to by pointers
within the structure. The returned pointer, and pointers within
the structure, might be invalidated or the structure or the storage
areas might be overwritten by a subsequent call to getservbyname(),
getservbyport(), or getservent()."
getserv*: P759 L25375 section endservent
Delete
"The getservbyname(), getservbyport(), and getservent() functions
may return pointers to static data, which may be overwritten by
subsequent calls to any of these functions."
getenv: P1008 L33858
Change
"The string pointed to may be overwritten by a subsequent call to
getenv(), [CX]setenv(), unsetenv(),[/CX] [XSI]or putenv()[/XSI]
but shall not be overwritten by a call to any other function in
this volume of POSIX.1-200x."
to
"[CX]The returned string pointer might be invalidated or[/CX] the
string content might be overwritten by a subsequent call to
getenv(), [CX]setenv(), unsetenv(),[/CX] [XSI]or putenv()[/XSI]
but they shall not be affected by a call to any other function in
this volume of POSIX.1-200x."
getgrgid: P1014 L34026
Change
"The return value may point to a static area which is overwritten
by a subsequent call to getgrent(), getgrgid(), or getgrnam()."
to
"The application shall not modify the structure to which the
return value points, nor any storage areas pointed to by pointers
within the structure. The returned pointer, and pointers within
the structure, might be invalidated or the structure or the storage
areas might be overwritten by a subsequent call to getgrent(),
getgrgid(), or getgrnam()."
getgrnam: P1018 L34154
Change
"The return value may point to a static area which is overwritten
by a subsequent call to getgrent(), getgrgid(), or getgrnam()."
to
"The application shall not modify the structure to which the
return value points, nor any storage areas pointed to by pointers
within the structure. The returned pointer, and pointers within
the structure, might be invalidated or the structure or the storage
areas might be overwritten by a subsequent call to getgrent(),
getgrgid(), or getgrnam()."
getlogin: P1029 L34474
Change
"The return value from getlogin() may point to static data whose
content is overwritten by each call."
to
"The application shall not modify the string returned.
The returned pointer might be invalidated or the string content
might be overwritten by a subsequent call to getlogin()."
getpwnam: P1058 L35324
Change
"The return value may point to a static area which is overwritten
by a subsequent call to getpwent(), getpwnam(), or getpwuid()."
to
"The application shall not modify the structure to which the
return value points, nor any storage areas pointed to by pointers
within the structure. The returned pointer, and pointers within
the structure, might be invalidated or the structure or the storage
areas might be overwritten by a subsequent call to getpwent(),
getpwnam(), or getpwuid()."
getpwuid: P1061 L35457
Change
"The return value may point to a static area which is overwritten
by a subsequent call to getpwent(), getpwnam(), or getpwuid()."
to
"The application shall not modify the structure to which the
return value points, nor any storage areas pointed to by pointers
within the structure. The returned pointer, and pointers within
the structure, might be invalidated or the structure or the storage
areas might be overwritten by a subsequent call to getpwent(),
getpwnam(), or getpwuid()."
localeconv: P1235 L40722
Change
"The application shall not modify the structure pointed to
by the return value which may be overwritten by a subsequent call
to localeconv(). In addition, calls to setlocale() with the
categories LC_ALL, LC_MONETARY, or LC_NUMERIC or calls to
uselocale()
which change the categories LC_MONETARY or LC_NUMERIC may overwrite
the contents of the structure."
to
"The application shall not modify the structure to which the
return value points, [CX]nor any storage areas pointed to by
pointers within the structure. The returned pointer, and pointers
within the structure, might be invalidated or[/CX] the structure
[CX]or the storage areas[/CX] might be overwritten by a subsequent
call to localeconv(). In addition, [CX]the returned pointer, and
pointers within the structure, might be invalidated or[/CX] the
structure [CX]or the storage areas[/CX] might be overwritten by
subsequent calls to setlocale() with the categories LC_ALL,
LC_MONETARY, or LC_NUMERIC, [CX]or by calls to uselocale() which
change the categories LC_MONETARY or LC_NUMERIC[/CX]."
nl_langinfo: P1375 L45104
Delete
"Calls to setlocale() with a category corresponding to the
category of item (see <langinfo.h>), or to the category LC_ALL,
may overwrite the array pointed to by the return value. Calls to
uselocale() which change the category corresponding to the
category of item may overwrite the array pointed to by the return
value."
nl_langinfo: P1375 L45113
Change
"This pointer may point to static data that may be overwritten on
the next call to either function."
to
"The application shall not modify the string returned.
The returned pointer might be invalidated or the string content
might be overwritten by a subsequent call to either function, by
subsequent calls to setlocale() with a category corresponding to
the category of item (see <langinfo.h>) or the category LC_ALL, or
by subsequent calls to uselocale() which change the category
corresponding to the category of item."
ptsname: P1712 L54754
Add a new paragraph to the RETURN VALUE section:
"The application shall not modify the string returned.
The returned pointer might be invalidated or the string content
might be overwritten by a subsequent call to ptsname()."
ptsname: P1712 L54760
Change
"The value returned may point to a static data area that is
overwritten by each call to ptsname()."
to
"None"
readdir: P1744 L55685
Change
"The pointer returned by readdir() points to data which may be
overwritten by another call to readdir() on the same directory
stream. This data is not overwritten by another call to readdir()
on a different directory stream."
to
"The application shall not modify the structure to which the
return value of readdir() points, nor any storage areas pointed to
by pointers within the structure. The returned pointer, and
pointers within the structure, might be invalidated or the
structure or the storage areas might be overwritten by a
subsequent call to readdir() on the same directory stream.
They shall not be affected by a call to readdir() on a different
directory stream."
strerror: P1999 L63238
Change
"The string pointed to shall not be modified by the application.
The string may be overwritten by a subsequent call to strerror().
[CX]The string may be overwritten by a subsequent call to
strerror_l() in the same thread.[/CX]"
to
"The application shall not modify the string returned.
[CX]The returned string pointer might be invalidated or[/CX] the
string content might be overwritten by a subsequent call to
strerror(), [CX]or by a subsequent call to strerror_l() in the
same thread[/CX]."
strsignal: P2032 L64345
Change
"The string pointed to shall not be modified by the application,
but may be overwritten by a subsequent call to strsignal() or
setlocale()."
to
"The application shall not modify the string returned.
The returned pointer might be invalidated or the string content
might be overwritten by a subsequent call to strsignal() or
setlocale()."
ttyname: P2140 L67655
Change
"The return value may point to static data whose content is
overwritten by each call."
to
"The application shall not modify the string returned.
The returned pointer might be invalidated or the string content
might be overwritten by a subsequent call to ttyname()."
======================================================================
|