summaryrefslogtreecommitdiff
path: root/src/w32notify.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2016-02-06 18:30:35 +0200
committerEli Zaretskii <eliz@gnu.org>2016-02-06 18:30:35 +0200
commitbe1d87492e2fba479151edcaf7f3818675b1eac7 (patch)
tree178d308e60f9f2774c9df216b9b7db157724a3ba /src/w32notify.c
parent87ae21858adc173c129ff8dfec8ce74cd82e77be (diff)
downloademacs-be1d87492e2fba479151edcaf7f3818675b1eac7.tar.gz
Fix issues found by auditing w32notify code
* src/w32inevt.c (handle_file_notifications): Count the number of events to be returned. * src/w32notify.c (send_notifications): Don't copy to the file notification buffer more than it can hold. (Bug#22534)
Diffstat (limited to 'src/w32notify.c')
-rw-r--r--src/w32notify.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/w32notify.c b/src/w32notify.c
index 576cf844dab..71787c45db8 100644
--- a/src/w32notify.c
+++ b/src/w32notify.c
@@ -144,8 +144,9 @@ send_notifications (BYTE *info, DWORD info_size, void *desc,
if (!notification_buffer_in_use)
{
if (info_size)
- memcpy (file_notifications, info, info_size);
- notifications_size = info_size;
+ memcpy (file_notifications, info,
+ min (info_size, sizeof (file_notifications)));
+ notifications_size = min (info_size, sizeof (file_notifications));
notifications_desc = desc;
/* If PostMessage fails, the message queue is full. If that
happens, the last thing they will worry about is file