瀏覽代碼

wayland: Add null check for zenity version string

Etaash Mathamsetty 2 年之前
父節點
當前提交
2a9480c815
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/video/wayland/SDL_waylandmessagebox.c

+ 4 - 0
src/video/wayland/SDL_waylandmessagebox.c

@@ -96,6 +96,10 @@ static int get_zenity_version(int *major, int *minor) {
         version_ptr = fgets(version_str, ZENITY_VERSION_LEN, outputfp);
         version_ptr = fgets(version_str, ZENITY_VERSION_LEN, outputfp);
         (void)fclose(outputfp); /* will close underlying fd */
         (void)fclose(outputfp); /* will close underlying fd */
 
 
+        if (version_ptr == NULL) {
+            return SDL_SetError("failed to read zenity version string");
+        }
+
         /* we expect the version string is in the form of MAJOR.MINOR.MICRO
         /* we expect the version string is in the form of MAJOR.MINOR.MICRO
          * as described in meson.build. We'll ignore everything after that.
          * as described in meson.build. We'll ignore everything after that.
          */
          */