projects
/
systemd
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0a040e6
)
test-strxcpyx: check result of snprintf
author
Luca Boccassi
<luca.boccassi@microsoft.com>
Sun, 14 Nov 2021 01:28:42 +0000
(
01:28
+0000)
committer
Luca Boccassi
<luca.boccassi@microsoft.com>
Sun, 14 Nov 2021 01:28:42 +0000
(
01:28
+0000)
src/test/test-strxcpyx.c
patch
|
blob
|
history
diff --git
a/src/test/test-strxcpyx.c
b/src/test/test-strxcpyx.c
index 4b6d8ebce30d4c3196c11e9abcb097281648dc89..c68fe3c06444233aa6f48a3556967cb82cdc3a5c 100644
(file)
--- a/
src/test/test-strxcpyx.c
+++ b/
src/test/test-strxcpyx.c
@@
-83,10
+83,13
@@
static void test_sd_event_code_migration(void) {
char c[100 * DECIMAL_STR_MAX(unsigned) + 1], *p;
unsigned i;
size_t l;
- int o;
+ int o
, r
;
- for (i = o = 0; i < 100; i++)
- o += snprintf(&b[o], sizeof(b) - o, "%u ", i);
+ for (i = o = 0; i < 100; i++) {
+ r = snprintf(&b[o], sizeof(b) - o, "%u ", i);
+ assert_se(r >= 0 && r < (int) sizeof(b) - o);
+ o += r;
+ }
p = c;
l = sizeof(c);