Browse Source

- fixed size calculation bug, size_t instead int is used now

development
Andreas Romeyke 2 years ago
parent
commit
dd2d031b62
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      src/helper/check_helper.c

+ 3
- 3
src/helper/check_helper.c View File

@ -35,16 +35,16 @@ char * secstrcat (char * dest, const char * src, size_t * maxsize_p) {
if (maxdest < maxsize-1) {
strncat( dest, src, srclen);
} else {
int new_maxsize=(((maxdest) / RENDERSIZE)+1) * RENDERSIZE-1;
size_t new_maxsize=(((maxdest) / RENDERSIZE)+1) * RENDERSIZE-1;
if (
(new_maxsize < 4096*RENDERSIZE) &&
(new_maxsize < 4096*RENDERSIZE) &&
(new_maxsize > 0)
) {
char * dest_new = NULL;
dest_new = realloc(dest, (new_maxsize+1) * sizeof(char));
if (NULL == dest_new) {
perror( "Could not realloc memory");
exit( could_not_allocate_memory );
exit( could_not_allocate_memory );
} else {
*maxsize_p = new_maxsize;
dest = dest_new;


Loading…
Cancel
Save