diff options
| author | ruki <[email protected]> | 2025-12-19 22:57:12 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-12-19 22:57:12 +0800 |
| commit | 4ee281946a1a242d755763d4082828811614edef (patch) | |
| tree | b718c226cfc999b4f30755fcd89e1000066a30ff /core/src | |
| parent | fd321d6e6777618a12f430269dca9263df9a371e (diff) | |
improve path buffer
Diffstat (limited to 'core/src')
| -rw-r--r-- | core/src/xmake/binutils/elf/rpath.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/src/xmake/binutils/elf/rpath.c b/core/src/xmake/binutils/elf/rpath.c index 2267ca09f..a7d6ed66b 100644 --- a/core/src/xmake/binutils/elf/rpath.c +++ b/core/src/xmake/binutils/elf/rpath.c @@ -36,13 +36,14 @@ static tb_void_t xm_binutils_elf_add_rpaths(lua_State *lua, tb_char_t const* rpath, tb_size_t* pcount) { if (!rpath || !*rpath) return; + tb_char_t path[TB_PATH_MAXN]; tb_char_t const* p = rpath; tb_char_t const* e = tb_null; while (*p) { e = tb_strchr(p, ':'); tb_size_t n = e ? (tb_size_t)(e - p) : tb_strlen(p); if (n > 0) { - tb_char_t path[TB_PATH_MAXN]; + if (n > sizeof(path) - 1) n = sizeof(path) - 1; tb_strncpy(path, p, n); path[n] = '\0'; |
