Bug 193235 - basename(3) potentially failing with ENOMEM, etc is not documented
Summary: basename(3) potentially failing with ENOMEM, etc is not documented
Status: Closed Overcome By Events
Alias: None
Product: Documentation
Classification: Unclassified
Component: Manual Pages (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-02 01:18 UTC by Enji Cooper
Modified: 2024-01-19 00:31 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Enji Cooper freebsd_committer freebsd_triage 2014-09-02 01:18:15 UTC
basename(3) creates a static buffer for storing paths. This libcall can fail if malloc fails however, and this potential failure isn't documented in the manage:

68 char *
69 basename(const char *path)
70 {
71         static char *bname = NULL;
72 
73         if (bname == NULL) {
74                 bname = (char *)malloc(MAXPATHLEN);
75                 if (bname == NULL)
76                         return (NULL);
77         }
Comment 1 Yuri Pankov freebsd_committer freebsd_triage 2018-10-31 05:47:08 UTC
Note that basename(3) was reimplemented in FreeBSD 12, and correctly doesn't have any errors defined, so this only applies to 11.2/11-STABLE at the moment.
Comment 2 Ridge_Sylvester 2024-01-18 19:54:58 UTC
MARKED AS SPAM
Comment 3 Mark Johnston freebsd_committer freebsd_triage 2024-01-18 19:57:18 UTC
OBE per comment 1.