mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 16:26:39 +01:00
Terminal: fix possible buffer overflow
This commit is contained in:
@@ -262,10 +262,10 @@ static void detectFromWindowsTerminal(const FFstrbuf* terminalExe, FFTerminalFon
|
||||
static bool queryKittyTerm(const char* query, FFstrbuf* res)
|
||||
{
|
||||
// https://github.com/fastfetch-cli/fastfetch/discussions/1030#discussioncomment-9845233
|
||||
char buffer[64] = "";
|
||||
char buffer[256] = "";
|
||||
if (ffGetTerminalResponse(
|
||||
query, // kitty-query-font_family;kitty-query-font_size
|
||||
"\eP1+r%*[^=]=%64[^\e]\e\\", buffer) == NULL && *buffer)
|
||||
"\eP1+r%*[^=]=%255[^\e]\e\\", buffer) == NULL)
|
||||
{
|
||||
// decode hex string
|
||||
for (const char* p = buffer; p[0] && p[1]; p += 2)
|
||||
|
||||
@@ -507,11 +507,11 @@ static bool getTerminalVersionZed(FFstrbuf* exe, FFstrbuf* version)
|
||||
#ifndef _WIN32
|
||||
static bool getTerminalVersionKitty(FFstrbuf* exe, FFstrbuf* version)
|
||||
{
|
||||
char versionHex[64] = "";
|
||||
char versionHex[64];
|
||||
// https://github.com/fastfetch-cli/fastfetch/discussions/1030#discussioncomment-9845233
|
||||
if (ffGetTerminalResponse(
|
||||
"\eP+q6b697474792d71756572792d76657273696f6e\e\\", // kitty-query-version
|
||||
"\eP1+r%*[^=]=%64[^\e]\e\\\\", versionHex) == NULL && *versionHex)
|
||||
"\eP1+r%*[^=]=%63[^\e]\e\\\\", versionHex) == NULL)
|
||||
{
|
||||
// decode hex string
|
||||
for (const char* p = versionHex; p[0] && p[1]; p += 2)
|
||||
|
||||
Reference in New Issue
Block a user