code quality: Address Copilot review comments

This commit is contained in:
matt335672
2026-02-27 11:51:39 +00:00
parent 0c92f5f5a2
commit 12102934b3
4 changed files with 27 additions and 12 deletions
+9 -2
View File
@@ -232,7 +232,10 @@ g_get_display_string(char buff[], unsigned int bufflen)
// Return the unqualified part of the name
p = strrchr(str, '/');
p = (p != NULL) ? (p + 1) : str;
strlcpy(buff, p, bufflen);
if (strlcpy(buff, p, bufflen) >= bufflen)
{
rv = -1; /* Buffer overflow */
}
}
else if ((str = g_getenv("DISPLAY")) != NULL)
{
@@ -240,7 +243,11 @@ g_get_display_string(char buff[], unsigned int bufflen)
if (n >= 0)
{
g_snprintf(buff, bufflen, "X11-%d", n);
if ((unsigned int)g_snprintf(buff, bufflen, "X11-%d", n)
>= bufflen)
{
rv = -1; /* Buffer overflow */
}
}
else
{