Skip to content

Commit 503fc45

Browse files
internal: replace unsafe strcpy with snprintf (#11128)
1 parent a3d59b5 commit 503fc45

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/debug/HyprCtl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2026,7 +2026,7 @@ void CHyprCtl::startHyprCtlSocket() {
20262026

20272027
m_socketPath = g_pCompositor->m_instancePath + "/.socket.sock";
20282028

2029-
strcpy(SERVERADDRESS.sun_path, m_socketPath.c_str());
2029+
snprintf(SERVERADDRESS.sun_path, sizeof(SERVERADDRESS.sun_path), "%s", m_socketPath.c_str());
20302030

20312031
if (bind(m_socketFD.get(), (sockaddr*)&SERVERADDRESS, SUN_LEN(&SERVERADDRESS)) < 0) {
20322032
Debug::log(ERR, "Couldn't start the Hyprland Socket. (2) IPC will not work.");

src/render/OpenGL.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ static int openRenderNode(int drmFd) {
107107
Debug::log(LOG, "DRM dev versionName", render_version->name);
108108
if (strcmp(render_version->name, "evdi") == 0) {
109109
free(renderName);
110-
renderName = (char*)malloc(sizeof(char) * 15);
111-
strcpy(renderName, "/dev/dri/card0");
110+
renderName = strdup("/dev/dri/card0");
112111
}
113112
drmFreeVersion(render_version);
114113
}

0 commit comments

Comments
 (0)