Bounds checking :)
This commit is contained in:
parent
d018d128a0
commit
165352cdca
@ -1,5 +1,6 @@
|
|||||||
#include "minitar.h"
|
#include "minitar.h"
|
||||||
#include "tar.h"
|
#include "tar.h"
|
||||||
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.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* minitar_static_dup(const char* str, size_t size)
|
||||||
{
|
{
|
||||||
static char result[1024];
|
static char result[1024];
|
||||||
|
assert(size < 1024);
|
||||||
memcpy(result, str, size);
|
memcpy(result, str, size);
|
||||||
result[size] = 0;
|
result[size] = 0;
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
Reference in New Issue
Block a user