From d57672e2a6737d891f00b1bb2bc12d715daa04b1 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 28 Feb 2022 10:27:05 +0100 Subject: [PATCH] include/strutils: mark some arguments as non-null Signed-off-by: Karel Zak --- include/strutils.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/strutils.h b/include/strutils.h index 8968524a61..ae689a30ad 100644 --- a/include/strutils.h +++ b/include/strutils.h @@ -90,7 +90,8 @@ static inline void xstrncpy(char *dest, const char *src, size_t n) * Use this function to copy string to logs with fixed sizes (wtmp/utmp. ...) * where string terminator is optional. */ -static inline void *str2memcpy(void *dest, const char *src, size_t n) +static inline void * __attribute__((nonnull (1))) +str2memcpy(void *dest, const char *src, size_t n) { size_t bytes = strlen(src) + 1; @@ -101,7 +102,8 @@ static inline void *str2memcpy(void *dest, const char *src, size_t n) return dest; } -static inline char *mem2strcpy(char *dest, const void *src, size_t n, size_t nmax) +static inline char * __attribute__((nonnull (1))) +mem2strcpy(char *dest, const void *src, size_t n, size_t nmax) { if (n + 1 > nmax) n = nmax - 1; -- 2.47.2