diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2008-08-29 13:44:24 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2008-08-29 13:44:24 +0000 |
commit | af9ec2d6d3007a48006d24a48b742ffee13484c3 (patch) | |
tree | 99a9cad3e2d2b81a426a27e1637dd3eb0fe8f586 /sys/dev/pci/drm | |
parent | f97a5a1b8f2662778e23c9353ec49fbbfbbdddf9 (diff) |
Don't memcpy too far whem drm_realloc() is called with a smaller size.
This was never noticed since it's always used with a larger size.
Noticed by Stephane Marchesin.
Diffstat (limited to 'sys/dev/pci/drm')
-rw-r--r-- | sys/dev/pci/drm/drm_memory.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/dev/pci/drm/drm_memory.c b/sys/dev/pci/drm/drm_memory.c index 91828111eec..81dc4a10e98 100644 --- a/sys/dev/pci/drm/drm_memory.c +++ b/sys/dev/pci/drm/drm_memory.c @@ -72,7 +72,7 @@ drm_realloc(void *oldpt, size_t oldsize, size_t size, int area) if (pt == NULL) return NULL; if (oldpt && oldsize) { - memcpy(pt, oldpt, oldsize); + memcpy(pt, oldpt, min(oldsize, size)); free(oldpt, M_DRM); } return pt; |