summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authororbisai0security <[email protected]>2026-06-08 07:34:40 +0000
committerRbb666 <[email protected]>2026-06-16 15:43:44 +0800
commitb210bd84ebec82ce6e8cc8218c6e92656bb7f72e (patch)
tree8ab3e207e0b816d79ccb50f769e134ef42297f1c /components
parent810955a3f12e121222d8b1aeec17b46252731a8b (diff)
fix: V-004 security vulnerability
Automated security fix generated by OrbisAI Security
Diffstat (limited to 'components')
-rw-r--r--components/lwp/terminal/tty_ptmx.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/components/lwp/terminal/tty_ptmx.c b/components/lwp/terminal/tty_ptmx.c
index 371c27a26b..5938bf0103 100644
--- a/components/lwp/terminal/tty_ptmx.c
+++ b/components/lwp/terminal/tty_ptmx.c
@@ -290,7 +290,7 @@ rt_err_t lwp_ptmx_init(rt_device_t ptmx_device, const char *root_path)
if (device_name)
{
/* Register device */
- sprintf(device_name, "%s%s", root_path, dev_rel_path);
+ snprintf(device_name, root_len + sizeof("/ptmx"), "%s%s", root_path, dev_rel_path);
rt_device_register(ptmx_device, device_name, 0);
/* Setup fops */
@@ -318,7 +318,7 @@ static rt_err_t sysptmx_readlink(struct rt_device *dev, char *buf, int len)
int rc = 0;
/* TODO: support multi-root ? */
- strncpy(buf, "pts/ptmx", len);
+ snprintf(buf, len, "pts/ptmx");
return rc;
}