aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2016-02-06 18:30:35 +0200
committerEli Zaretskii2016-02-06 18:30:35 +0200
commitbe1d87492e2fba479151edcaf7f3818675b1eac7 (patch)
tree178d308e60f9f2774c9df216b9b7db157724a3ba /src
parent87ae21858adc173c129ff8dfec8ce74cd82e77be (diff)
downloademacs-be1d87492e2fba479151edcaf7f3818675b1eac7.tar.gz
emacs-be1d87492e2fba479151edcaf7f3818675b1eac7.zip
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')
-rw-r--r--src/w32inevt.c1
-rw-r--r--src/w32notify.c5
2 files changed, 4 insertions, 2 deletions
diff --git a/src/w32inevt.c b/src/w32inevt.c
index 54b0b13f54e..e714e27f4bc 100644
--- a/src/w32inevt.c
+++ b/src/w32inevt.c
@@ -660,6 +660,7 @@ handle_file_notifications (struct input_event *hold_quit)
660 inev.arg = list3 (make_pointer_integer (notifications_desc), 660 inev.arg = list3 (make_pointer_integer (notifications_desc),
661 action, fname); 661 action, fname);
662 kbd_buffer_store_event_hold (&inev, hold_quit); 662 kbd_buffer_store_event_hold (&inev, hold_quit);
663 nevents++;
663 664
664 if (!fni->NextEntryOffset) 665 if (!fni->NextEntryOffset)
665 break; 666 break;
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,
144 if (!notification_buffer_in_use) 144 if (!notification_buffer_in_use)
145 { 145 {
146 if (info_size) 146 if (info_size)
147 memcpy (file_notifications, info, info_size); 147 memcpy (file_notifications, info,
148 notifications_size = info_size; 148 min (info_size, sizeof (file_notifications)));
149 notifications_size = min (info_size, sizeof (file_notifications));
149 notifications_desc = desc; 150 notifications_desc = desc;
150 /* If PostMessage fails, the message queue is full. If that 151 /* If PostMessage fails, the message queue is full. If that
151 happens, the last thing they will worry about is file 152 happens, the last thing they will worry about is file