mirror of
https://github.com/tailix/libkernaux.git
synced 2025-02-17 15:45:32 -05:00
Main: fix potential buffer overflow (closes #25)
This commit is contained in:
parent
8c2c865d46
commit
2a510851e4
2 changed files with 7 additions and 6 deletions
|
@ -1,3 +1,7 @@
|
|||
2022-02-01 Alex Kotov <kotovalexarian@gmail.com>
|
||||
|
||||
* src/printf.c: Fix potential buffer overflow
|
||||
|
||||
2022-01-24 Alex Kotov <kotovalexarian@gmail.com>
|
||||
|
||||
* include/kernaux/ntoa.h: Add func "kernaux_itoa"
|
||||
|
|
|
@ -576,6 +576,7 @@ size_t _ntoa_long_long(out_fct_type out, char* buffer, size_t idx, size_t maxlen
|
|||
* Idea: superleaf1995
|
||||
* Implementation: smwmaster
|
||||
*/
|
||||
static const size_t map_size = 630;
|
||||
static const char *const map =
|
||||
"\xD3\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9"
|
||||
"\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xD3\xF9\xF9"
|
||||
|
@ -611,15 +612,11 @@ static const char *const map =
|
|||
"\xF7\xF9\xF9\xD3\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9"
|
||||
"\xF9\xF9\xF9\xF9\xF5\xB2\x96\xE9\xE9\x96\xA1\xBD\xF5\xF9\xF9\xF9\xF9\xF9"
|
||||
"\xD3\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9"
|
||||
"\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xD3\xD3\xD9"
|
||||
"\xD9\xD9\xC1\x04&&i\x05&&i\x05&&\xC9\x04&&i\x05&&i\x05&&i\x05&&i\x05&&i"
|
||||
"\x05&&i\x05&&i\x05&&\xD1\x04&&i\x05&&\xD9\x04&&i\x05&&i\x05&&)\x05&&\xFB"
|
||||
"\x06&&-\x05&&-\x05&&-\x05&&-\x05&&-\x05&&-\x05&&-\x05&&-\x05&&-\x05&&-\x05"
|
||||
"&&-\x05&&-\x05&&-\x05&&-\x05&&-\x05&&-\x05&&-\x05&&-\x05&&-\x05&&-\x05&&"
|
||||
"\xD1\x06&&-\x05&&\xCA\x04&&-\x05&&";
|
||||
"\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xF9\xD3\xD3\xD9";
|
||||
|
||||
char _custom(const unsigned int flags, size_t *const index)
|
||||
{
|
||||
if (*index >= map_size) return '\0';
|
||||
return map[(*index)++] ^ (73 + ((flags >> 8) | 128));
|
||||
}
|
||||
#endif // ENABLE_BLOAT
|
||||
|
|
Loading…
Add table
Reference in a new issue