Bounds checking :)

This commit is contained in:
apio 2022-12-30 11:13:55 +01:00
parent d018d128a0
commit 165352cdca
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -1,5 +1,6 @@
#include "minitar.h"
#include "tar.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -93,6 +94,7 @@ static size_t minitar_align_down_to_block_size(size_t size)
static char* minitar_static_dup(const char* str, size_t size)
{
static char result[1024];
assert(size < 1024);
memcpy(result, str, size);
result[size] = 0;
return result;