mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
server: verify CWD string length matches the indicated length
This commit is contained in:
parent
cd382a467c
commit
c91ef4c512
1 changed files with 6 additions and 0 deletions
6
server.c
6
server.c
|
|
@ -181,6 +181,12 @@ fdm_client(struct fdm *fdm, int fd, int events, void *data)
|
|||
const char *cwd = (const char *)p; p += cwd_len;
|
||||
LOG_DBG("CWD = %.*s", cwd_len, cwd);
|
||||
|
||||
if (cwd_len != strlen(cwd) + 1) {
|
||||
LOG_ERR("CWD length mismatch: indicated = %hu, actual = %zu",
|
||||
cwd_len - 1, strlen(cwd));
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
CHECK_BUF(sizeof(uint16_t));
|
||||
uint16_t term_env_len = *(uint16_t *)p; p += sizeof(term_env_len);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue