internal: replace unsafe strcpy with snprintf (#11128)

This commit is contained in:
MirzaSamadAhmedBaig 2025-07-20 18:31:53 +05:00 committed by GitHub
parent a3d59b525b
commit 503fc458d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 3 deletions

View file

@ -2026,7 +2026,7 @@ void CHyprCtl::startHyprCtlSocket() {
m_socketPath = g_pCompositor->m_instancePath + "/.socket.sock"; m_socketPath = g_pCompositor->m_instancePath + "/.socket.sock";
strcpy(SERVERADDRESS.sun_path, m_socketPath.c_str()); snprintf(SERVERADDRESS.sun_path, sizeof(SERVERADDRESS.sun_path), "%s", m_socketPath.c_str());
if (bind(m_socketFD.get(), (sockaddr*)&SERVERADDRESS, SUN_LEN(&SERVERADDRESS)) < 0) { if (bind(m_socketFD.get(), (sockaddr*)&SERVERADDRESS, SUN_LEN(&SERVERADDRESS)) < 0) {
Debug::log(ERR, "Couldn't start the Hyprland Socket. (2) IPC will not work."); Debug::log(ERR, "Couldn't start the Hyprland Socket. (2) IPC will not work.");

View file

@ -107,8 +107,7 @@ static int openRenderNode(int drmFd) {
Debug::log(LOG, "DRM dev versionName", render_version->name); Debug::log(LOG, "DRM dev versionName", render_version->name);
if (strcmp(render_version->name, "evdi") == 0) { if (strcmp(render_version->name, "evdi") == 0) {
free(renderName); free(renderName);
renderName = (char*)malloc(sizeof(char) * 15); renderName = strdup("/dev/dri/card0");
strcpy(renderName, "/dev/dri/card0");
} }
drmFreeVersion(render_version); drmFreeVersion(render_version);
} }