summaryrefslogtreecommitdiff
path: root/payloads/libpayload
diff options
context:
space:
mode:
Diffstat (limited to 'payloads/libpayload')
-rw-r--r--payloads/libpayload/libc/memory.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/payloads/libpayload/libc/memory.c b/payloads/libpayload/libc/memory.c
index 2c44764edb..8d0172cc44 100644
--- a/payloads/libpayload/libc/memory.c
+++ b/payloads/libpayload/libc/memory.c
@@ -41,8 +41,10 @@ static void *default_memset(void *s, int c, size_t n)
u8 *p = s;
s = (void *)ALIGN_UP((uintptr_t)s, sizeof(unsigned long));
- while (p != (u8 *)s && n--)
+ while (p != (u8 *)s && n) {
*p++ = c;
+ n--;
+ }
for (i = 1; i < sizeof(unsigned long); i <<= 1)
w = (w << (i * 8)) | w;