Opened 6 years ago

Closed 6 years ago

#9931 closed enhancement (fixed)

Allocate returned buffer in realpath() in case resolved_name's argument is NULL

Reported by: oco Owned by: korli
Priority: normal Milestone: R1
Component: System/libroot.so Version: R1/alpha4.1
Keywords: realpath Cc:
Blocked By: Blocking:
Has a Patch: yes Platform: All

Description

Add support for NULL as resolved_name argument in realpath as defined in The Open Group Base Specifications Issue 7 IEEE Std 1003.1, 2013 Edition (http://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html).

In this case, the returned buffer is allocated by realpath and can be passed to free().

The behavior was only "implementation defined" in previous revision like The Open Group Base Specifications Issue 6 IEEE Std 1003.1, 2004 Edition (http://pubs.opengroup.org/onlinepubs/000095399/functions/realpath.html).

Yodl (http://yodl.sourceforge.net/) rely on this behavior in yodl/src/lexer/lchdir.c.

Attachments (1)

0001-Add-support-for-NULL-as-resolved_name-argument-in-re.patch (1.8 KB ) - added by oco 6 years ago.

Download all attachments as: .zip

Change History (4)

comment:1 by oco, 6 years ago

Has a Patch: set

comment:2 by korli, 6 years ago

Owner: changed from axeld to korli
Status: newassigned

comment:3 by korli, 6 years ago

Resolution: fixed
Status: assignedclosed

Edited and applied in hrev46345. In case of error, the newly allocated buffer shall be freed.

Note: See TracTickets for help on using tickets.