Skip to content

Commit 41d1775

Browse files
committed
Fix: Undercounted one byte in xy_strjoin() causes buffer overflow
[GitHub #232]
1 parent c840acc commit 41d1775

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/xy.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Contributors : juzeon <[email protected]>
99
* |
1010
* Created On : <2023-08-28>
11-
* Last Modified : <2025-07-11>
11+
* Last Modified : <2025-07-19>
1212
*
1313
* xy: 襄阳、咸阳
1414
* Corss-Platform C11 utilities for CLI applications in mixed flavor (mostly Ruby)
@@ -17,7 +17,7 @@
1717
#ifndef XY_H
1818
#define XY_H
1919

20-
#define _XY_Version "v0.1.5.1-2025/07/11"
20+
#define _XY_Version "v0.1.5.2-2025/07/19"
2121
#define _XY_Maintain_URL "https://github.com/RubyMetric/chsrc/blob/dev/lib/xy.h"
2222
#define _XY_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc/blob/dev/lib/xy.h"
2323

@@ -247,11 +247,10 @@ xy_strjoin (unsigned int count, ...)
247247

248248
for (int i = 0; i < count; i++)
249249
{
250-
// 是否需要重新分配
251250
bool need_realloc = false;
252251

253252
str = va_arg (args, const char *);
254-
al_need += strlen (str);
253+
al_need += strlen (str) + 1;
255254
while (al_need > al_cur)
256255
{
257256
al_times += 1;

0 commit comments

Comments
 (0)