From 36656ff70e3d8971117b0d25b2afd2727b09b098 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Mon, 16 Oct 2023 09:00:45 +0800 Subject: [PATCH] Properly initialize argment list supplied to android_init_emacs * src/android.c (initEmacs): NULL-terminate c_argv. --- src/android.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/android.c b/src/android.c index 8c4748cccf6..9f0e966a602 100644 --- a/src/android.c +++ b/src/android.c @@ -1826,7 +1826,7 @@ NATIVE_NAME (initEmacs) (JNIEnv *env, jobject object, jarray argv, android_java_env = env; nelements = (*env)->GetArrayLength (env, argv); - c_argv = alloca (sizeof *c_argv * nelements); + c_argv = alloca (sizeof *c_argv * (nelements + 1)); for (i = 0; i < nelements; ++i) { @@ -1844,6 +1844,8 @@ NATIVE_NAME (initEmacs) (JNIEnv *env, jobject object, jarray argv, (*env)->ReleaseStringUTFChars (env, (jstring) argument, c_argument); } + c_argv[nelements] = NULL; + android_init_emacs_service (); android_init_emacs_pixmap (); android_init_graphics_point (); -- 2.39.2