Both The Single UNIX ® Specification, Version 2 (1997) and The Open Group Base Specifications Issue 6 (2004) require that readlink
would not place a null-terminated value in buffer
:
APPLICATION USAGE
Conforming applications should not assume that the returned contents of the symbolic link are null-terminated.
What are the considerations in not null-terminating buffer
? Couldn't it pose a security risk when readlink
isn't properly used?