mirror of
https://github.com/AuxXxilium/eudev.git
synced 2024-12-22 15:03:34 +07:00
Fix buffer overflow
Signed-off-by: Ian Stakenvicius <axs@gentoo.org>
This commit is contained in:
parent
d8d626c7df
commit
50758bdd96
@ -337,13 +337,15 @@ size_t util_strpcpyf(char **dest, size_t size, const char *src, ...)
|
||||
va_list va;
|
||||
int i;
|
||||
|
||||
if (!size) return 0; /*Nothing to do if size is 0*/
|
||||
|
||||
va_start(va, src);
|
||||
i = vsnprintf(*dest, size, src, va);
|
||||
if (i < (int)size) {
|
||||
*dest += i;
|
||||
size -= i;
|
||||
} else {
|
||||
*dest += size;
|
||||
*dest += size - 1;
|
||||
size = 0;
|
||||
}
|
||||
va_end(va);
|
||||
|
Loading…
Reference in New Issue
Block a user