[lxc-devel] [lxc/lxc] 91bc7f: confile: improve strprint()
GitHub
noreply at github.com
Wed May 30 16:41:41 UTC 2018
Branch: refs/heads/stable-3.0
Home: https://github.com/lxc/lxc
Commit: 91bc7fb0d3f3eae129cfe825ce667b39a4736906
https://github.com/lxc/lxc/commit/91bc7fb0d3f3eae129cfe825ce667b39a4736906
Author: Christian Brauner <christian.brauner at ubuntu.com>
Date: 2018-05-30 (Wed, 30 May 2018)
Changed paths:
M src/lxc/confile_utils.h
Log Message:
-----------
confile: improve strprint()
POSIX specifies [1]:
"If the value of n is zero on a call to snprintf(), nothing shall be written,
the number of bytes that would have been written had n been sufficiently large
excluding the terminating null shall be returned, and s may be a null pointer."
But in case there are any non-sane libcs out there that do actually dereference
the buffer when when 0 is passed as length to snprintf() let's give them a
dummy buffer.
[1]: The Open Group Base Specifications Issue 7, 2018 edition
IEEE Std 1003.1-2017 (Revision of IEEE Std 1003.1-2008)
Copyright © 2001-2018 IEEE and The Open Group
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
Reported-by: Donghwa Jeong <dh48.jeong at samsung.com>
**NOTE:** This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/
Functionality will be removed from GitHub.com on January 31st, 2019.
More information about the lxc-devel
mailing list