1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00

alloc-util: drop _alloc_(2, 3) decorator from memdup_suffix0_multiply()

This decorator tells compilers that the memory we return is shorter than
it actually is, thus triggering misleading bad memory access complaints.

Fixes: #13026
This commit is contained in:
Lennart Poettering 2019-07-12 09:06:28 +02:00
parent 27dd6e1b12
commit 7d025debfa

View File

@ -112,7 +112,9 @@ _alloc_(2, 3) static inline void *memdup_multiply(const void *p, size_t size, si
return memdup(p, size * need);
}
_alloc_(2, 3) static inline void *memdup_suffix0_multiply(const void *p, size_t size, size_t need) {
/* Note that we can't decorate this function with _alloc_() since the returned memory area is one byte larger
* than the product of its parameters. */
static inline void *memdup_suffix0_multiply(const void *p, size_t size, size_t need) {
if (size_multiply_overflow(size, need))
return NULL;