diff options
| author | Ray <[email protected]> | 2024-02-13 10:43:24 +0100 |
|---|---|---|
| committer | Ray <[email protected]> | 2024-02-13 10:43:24 +0100 |
| commit | bb741f53a8678914b4194b998b6c1d8a923bcae5 (patch) | |
| tree | 50bd2d2c8e65eb8a93c7773597453d0a1da51302 /src/rtext.c | |
| parent | 6280771dad01c03fa63eac0328dc4ff4710deda9 (diff) | |
| download | raylib-bb741f53a8678914b4194b998b6c1d8a923bcae5.tar.gz raylib-bb741f53a8678914b4194b998b6c1d8a923bcae5.zip | |
Update rtext.c
Diffstat (limited to 'src/rtext.c')
| -rw-r--r-- | src/rtext.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/rtext.c b/src/rtext.c index ba09c709..12be73e7 100644 --- a/src/rtext.c +++ b/src/rtext.c @@ -530,7 +530,7 @@ Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int Font font = { 0 }; char fileExtLower[16] = { 0 }; - strncpy(fileExtLower, TextToLower(fileType), sizeof(fileExtLower) - 1); + strncpy(fileExtLower, TextToLower(fileType), 16 - 1); font.baseSize = fontSize; font.glyphCount = (codepointCount > 0)? codepointCount : 95; @@ -971,7 +971,7 @@ bool ExportFontAsCode(Font font, const char *fileName) // Get file name from path char fileNamePascal[256] = { 0 }; - strcpy(fileNamePascal, TextToPascal(GetFileNameWithoutExt(fileName))); + strncpy(fileNamePascal, TextToPascal(GetFileNameWithoutExt(fileName)), 256 - 1); // NOTE: Text data buffer size is estimated considering image data size in bytes // and requiring 6 char bytes for every byte: "0x00, " @@ -1699,7 +1699,8 @@ const char **TextSplit(const char *text, char delimiter, int *count) return result; } -// Append text at specific position and move cursor! +// Append text at specific position and move cursor +// WARNING: It's up to the user to make sure appended text does not overflow the buffer! // REQUIRES: strcpy() void TextAppend(char *text, const char *append, int *position) { |
