浏览代码

[rtext] Change strcpy to strncpy to fix buffer overflow (#3795)

Mingjie Shen 1 年之前
父节点
当前提交
6280771dad
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/rtext.c

+ 1 - 1
src/rtext.c

@@ -530,7 +530,7 @@ Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int
     Font font = { 0 };
 
     char fileExtLower[16] = { 0 };
-    strcpy(fileExtLower, TextToLower(fileType));
+    strncpy(fileExtLower, TextToLower(fileType), sizeof(fileExtLower) - 1);
 
     font.baseSize = fontSize;
     font.glyphCount = (codepointCount > 0)? codepointCount : 95;