0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-09-22 10:43:39 -04:00

quote_for_pmake: fix counter underrun resulting in segfault

while (nbs--) { ... } ends with nbs == -1. Rather than a minimal fix,
introduce mempset() to make these kinds of errors less likely in the
future.

Fixes: https://bugzilla.nasm.us/show_bug.cgi?id=3392815
Reported-by: <13579and24680@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin
2022-11-07 10:26:03 -08:00
parent 7a2b5c9221
commit 2d4e695241
3 changed files with 13 additions and 7 deletions

View File

@@ -252,6 +252,13 @@ static inline void *mempcpy(void *dst, const void *src, size_t n)
}
#endif
#ifndef HAVE_MEMPSET
static inline void *mempset(void *dst, int c, size_t n)
{
return (char *)memset(dst, c, n) + n;
}
#endif
/*
* Hack to support external-linkage inline functions
*/