From 7fecafe015505c0ebd47780050118ff789a9ae3f Mon Sep 17 00:00:00 2001 From: jvoisin Date: Thu, 30 Apr 2026 17:57:51 +0200 Subject: Fix a POSIX violation for swab --- include/unistd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/unistd.h') diff --git a/include/unistd.h b/include/unistd.h index a2b3105..a73279b 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -177,7 +177,7 @@ _FORTIFY_FN(swab) void swab(const void * _FORTIFY_POS0 __os, size_t __bs = __bos(__os, 0); size_t __bd = __bos(__od, 0); - if ((size_t)__n > __bs || (size_t)__n > __bd) + if (__n > 0 && ((size_t)__n > __bs || (size_t)__n > __bd)) __builtin_trap(); return __orig_swab(__os, __od, __n); } -- cgit v1.3