forked from enlightenment/efl
eina: Provide actual len (after possible truncation) to eina_stringshare_add_length
Summary: vsnprintf() returns "The number of characters that would have been written if n had been sufficiently large", so if this is larger than the requested length, we pass the requested length to eina_stringshare_add_length, to avoid reading uninitialised memory. Fix T6903 Reviewers: zmike Subscribers: cedric Maniphest Tasks: T6903 Differential Revision: https://phab.enlightenment.org/D6011
This commit is contained in:
parent
0cf63649c7
commit
bf8ce8ff7a
|
@ -679,6 +679,8 @@ eina_stringshare_nprintf(unsigned int len, const char *fmt, ...)
|
|||
|
||||
if (size < 1)
|
||||
return "";
|
||||
if (size > len)
|
||||
size = len;
|
||||
|
||||
return eina_stringshare_add_length(tmp, size);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue