summaryrefslogtreecommitdiffstats
path: root/src/basic/alloc-util.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-05-19 23:24:55 +0200
committerGitHub <noreply@github.com>2021-05-19 23:24:55 +0200
commit2adcf6f4f7d1f74b02553d7128f73fcd2886fa55 (patch)
tree3c3defd6188d67e63effbb48121f2eb5e1d23f74 /src/basic/alloc-util.h
parentMerge pull request #19653 from poettering/greedy-realloc-more (diff)
parentalloc-util: use memcpy_safe() in memdup() or friends (diff)
downloadsystemd-2adcf6f4f7d1f74b02553d7128f73fcd2886fa55.tar.xz
systemd-2adcf6f4f7d1f74b02553d7128f73fcd2886fa55.zip
Merge pull request #19662 from yuwata/memdup
util: make memdup() or friends safer
Diffstat (limited to 'src/basic/alloc-util.h')
-rw-r--r--src/basic/alloc-util.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/basic/alloc-util.h b/src/basic/alloc-util.h
index 3ef126955b..99fbd3a889 100644
--- a/src/basic/alloc-util.h
+++ b/src/basic/alloc-util.h
@@ -66,7 +66,7 @@ void* memdup_suffix0(const void *p, size_t l); /* We can't use _alloc_() here, s
size_t _l_ = l; \
assert(_l_ <= ALLOCA_MAX); \
_q_ = alloca(_l_ ?: 1); \
- memcpy(_q_, p, _l_); \
+ memcpy_safe(_q_, p, _l_); \
})
#define memdupa_suffix0(p, l) \
@@ -76,7 +76,7 @@ void* memdup_suffix0(const void *p, size_t l); /* We can't use _alloc_() here, s
assert(_l_ <= ALLOCA_MAX); \
_q_ = alloca(_l_ + 1); \
((uint8_t*) _q_)[_l_] = 0; \
- memcpy(_q_, p, _l_); \
+ memcpy_safe(_q_, p, _l_); \
})
static inline void freep(void *p) {