From 729a01cda2842046fa55f2312d75f34ccad8d4a5 Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Fri, 31 Jan 2025 23:51:44 +0100 Subject: [PATCH] Taming static checker: don't memcpy zero length --- lib/attrs.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/attrs.h b/lib/attrs.h index c622fc0aa..ae9de9c64 100644 --- a/lib/attrs.h +++ b/lib/attrs.h @@ -33,7 +33,8 @@ static inline struct adata * lp_store_adata(struct linpool *pool, const void *buf, uint len) { struct adata *ad = lp_alloc_adata(pool, len); - memcpy(ad->data, buf, len); + if (len) + memcpy(ad->data, buf, len); return ad; } -- 2.47.2