unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#68421: Possible use after free in w32notify.c
@ 2024-01-13  7:49 Stefan Kangas
  2024-01-13  9:12 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Kangas @ 2024-01-13  7:49 UTC (permalink / raw)
  To: 68421

[-- Attachment #1: Type: text/plain, Size: 191 bytes --]

Could someone familiar with w32notify.c look over the attached patch?

It looks like we are trying to dereference NULL in add_watch, and
returning an already freed value from start_watching.

[-- Attachment #2: w32notify-ub.diff --]
[-- Type: text/x-diff, Size: 680 bytes --]

diff --git a/src/w32notify.c b/src/w32notify.c
index 9f8a62a1daa..c93e8796fe2 100644
--- a/src/w32notify.c
+++ b/src/w32notify.c
@@ -350,6 +350,7 @@ start_watching (const char *file, HANDLE hdir, BOOL subdirs, DWORD flags)
       xfree (dirwatch->io_info);
       xfree (dirwatch->watchee);
       xfree (dirwatch);
+      return NULL;
     }
   return dirwatch;
 }
@@ -412,10 +413,7 @@ add_watch (const char *parent_dir, const char *file, BOOL subdirs, DWORD flags)
     return NULL;
 
   if ((dirwatch = start_watching (file, hdir, subdirs, flags)) == NULL)
-    {
-      CloseHandle (hdir);
-      dirwatch->dir = NULL;
-    }
+    CloseHandle (hdir);
 
   return dirwatch;
 }

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#68421: Possible use after free in w32notify.c
  2024-01-13  7:49 bug#68421: Possible use after free in w32notify.c Stefan Kangas
@ 2024-01-13  9:12 ` Eli Zaretskii
  2024-01-13  9:25   ` Stefan Kangas
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2024-01-13  9:12 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 68421

> From: Stefan Kangas <stefankangas@gmail.com>
> Date: Sat, 13 Jan 2024 01:49:36 -0600
> 
> Could someone familiar with w32notify.c look over the attached patch?
> 
> It looks like we are trying to dereference NULL in add_watch, and
> returning an already freed value from start_watching.

Feel free to install on master, and thanks.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#68421: Possible use after free in w32notify.c
  2024-01-13  9:12 ` Eli Zaretskii
@ 2024-01-13  9:25   ` Stefan Kangas
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Kangas @ 2024-01-13  9:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 68421-done

Version: 30.1

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Stefan Kangas <stefankangas@gmail.com>
>> Date: Sat, 13 Jan 2024 01:49:36 -0600
>>
>> Could someone familiar with w32notify.c look over the attached patch?
>>
>> It looks like we are trying to dereference NULL in add_watch, and
>> returning an already freed value from start_watching.
>
> Feel free to install on master, and thanks.

Thanks, done in commit 893829021bd.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-13  9:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-13  7:49 bug#68421: Possible use after free in w32notify.c Stefan Kangas
2024-01-13  9:12 ` Eli Zaretskii
2024-01-13  9:25   ` Stefan Kangas

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).