diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2019-11-13 06:10:51 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2019-11-13 06:10:51 +0000 |
commit | 603b054c57b007db4f94e9cf21be76fc224a62a7 (patch) | |
tree | 9ae99e19eebe456dc654af669ca428c293b127ff /sys/dev/pci/drm | |
parent | 3d8a61246f186cfe0898b5c898b3c546f0de31b3 (diff) |
Fix off-by-one (truncation) in k{v,}asprintf().
ok jsg@
Diffstat (limited to 'sys/dev/pci/drm')
-rw-r--r-- | sys/dev/pci/drm/include/linux/kernel.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/pci/drm/include/linux/kernel.h b/sys/dev/pci/drm/include/linux/kernel.h index d0b274c88c8..99fa7b4bb8b 100644 --- a/sys/dev/pci/drm/include/linux/kernel.h +++ b/sys/dev/pci/drm/include/linux/kernel.h @@ -87,10 +87,10 @@ kasprintf(int flags, const char *fmt, ...) len = vsnprintf(NULL, 0, fmt, ap); va_end(ap); - buf = malloc(len, M_DRM, flags); + buf = malloc(len + 1, M_DRM, flags); if (buf) { va_start(ap, fmt); - vsnprintf(buf, len, fmt, ap); + vsnprintf(buf, len + 1, fmt, ap); va_end(ap); } @@ -105,9 +105,9 @@ kvasprintf(int flags, const char *fmt, va_list ap) len = vsnprintf(NULL, 0, fmt, ap); - buf = malloc(len, M_DRM, flags); + buf = malloc(len + 1, M_DRM, flags); if (buf) { - vsnprintf(buf, len, fmt, ap); + vsnprintf(buf, len + 1, fmt, ap); } return buf; |