Fix unsafe usage of string data on Android
authorPo Lu <luangruo@yahoo.com>
Wed, 29 May 2024 09:11:11 +0000 (17:11 +0800)
committerPo Lu <luangruo@yahoo.com>
Wed, 29 May 2024 09:11:11 +0000 (17:11 +0800)
* src/dired.c (open_directory): Reload name after calling
maybe_quit, which might invoke GC.

src/dired.c

index 37a9cad992f306955e3282459c3474541aa74e14..884d5df2410d2e0653f6c39224413a2322bf97c6 100644 (file)
@@ -126,6 +126,10 @@ open_directory (Lisp_Object dirname, Lisp_Object encoded_dirname, int *fdp)
   else if (errno == EINTR)
     {
       maybe_quit ();
+
+      /* Reload the address of DIRNAME's data, as it might have been
+        relocated by GC.  */
+      name = SSDATA (dirname);
       goto again;
     }
 #endif