瀏覽代碼

Don't crash if SDL_CreateJoystickGUID() is passed a NULL name

Sam Lantinga 3 年之前
父節點
當前提交
32700294e2
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/joystick/SDL_joystick.c

+ 4 - 0
src/joystick/SDL_joystick.c

@@ -1981,6 +1981,10 @@ SDL_CreateJoystickGUID(Uint16 bus, Uint16 vendor, Uint16 product, Uint16 version
 
     SDL_zero(guid);
 
+    if (!name) {
+        name = "";
+    }
+
     /* We only need 16 bits for each of these; space them out to fill 128. */
     /* Byteswap so devices get same GUID on little/big endian platforms. */
     *guid16++ = SDL_SwapLE16(bus);