Browse Source

- using secstrcat() correctly, using RENDERMINSIZE and RENDERMAXSIZE

development
Andreas Romeyke 2 years ago
parent
commit
0cbd57d4fe
4 changed files with 15 additions and 14 deletions
  1. +4
    -3
      src/headers/check_renderer.h
  2. +4
    -4
      src/helper/renderer/check_renderer_ansi.c
  3. +4
    -4
      src/helper/renderer/check_renderer_default.c
  4. +3
    -3
      src/helper/renderer/check_renderer_xml.c

+ 4
- 3
src/headers/check_renderer.h View File

@ -1,7 +1,7 @@
/* rule based checks if given TIFF is a specific baseline TIFF
*
*
* author: Andreas Romeyke, 2015-2017
* licensed under conditions of libtiff
* licensed under conditions of libtiff
* (see http://libtiff.maptools.org/misc.html)
*
*/
@ -13,7 +13,8 @@
/* 65536 Tags a 256 chars message + 100 Messages */
/* #define RENDERSIZE (65536*256 + 100*256) */
#define RENDERSIZE (4096)
#define RENDERMINSIZE (1024)
#define RENDERMAXSIZE (33554432)
typedef enum{ render_default, render_ansi, render_xml} render_type;
typedef enum{ within_valid, within_error, within_file, within_summaryerror, within_harderror } render_context_t;


+ 4
- 4
src/helper/renderer/check_renderer_ansi.c View File

@ -61,11 +61,11 @@ const char * renderer_ansi ( const retmsg_t * ret, short int is_quiet ) {
}
memset( res, '\0', RENDERSIZE);
*/
char * res = calloc(RENDERSIZE, sizeof(char));
char * res = calloc(RENDERMAXSIZE, sizeof(char));
if (NULL == res) {
exit(could_not_allocate_memory);
}
size_t rendersize_res = RENDERSIZE-1;
size_t rendersize_res = RENDERMAXSIZE;
/*
char * tmp = malloc( sizeof(char) * RENDERSIZE);
if (NULL == tmp) {
@ -73,11 +73,11 @@ const char * renderer_ansi ( const retmsg_t * ret, short int is_quiet ) {
}
memset( tmp, '\0', RENDERSIZE);
*/
char * tmp = calloc( RENDERSIZE, sizeof(char));
char * tmp = calloc( RENDERMINSIZE, sizeof(char));
if (NULL == tmp) {
exit(could_not_allocate_memory);
}
size_t rendersize_tmp = RENDERSIZE-1;
size_t rendersize_tmp = RENDERMINSIZE;
const retmsg_t * startp = ret;
short int rc_is_valid = 1;


+ 4
- 4
src/helper/renderer/check_renderer_default.c View File

@ -20,11 +20,11 @@ const char * renderer_default ( const retmsg_t * ret, short int is_quiet ) {
}
memset( res, '\0', RENDERSIZE);
*/
char * res = calloc(RENDERSIZE, sizeof(char));
char * res = calloc(RENDERMAXSIZE, sizeof(char));
if (NULL == res) {
exit(could_not_allocate_memory);
}
size_t rendersize_res = RENDERSIZE-1;
size_t rendersize_res = RENDERMAXSIZE;
/*
char * tmp = malloc( sizeof(char) * RENDERSIZE);
if (NULL == tmp) {
@ -32,11 +32,11 @@ const char * renderer_default ( const retmsg_t * ret, short int is_quiet ) {
}
memset( tmp, '\0', RENDERSIZE);
*/
char * tmp = calloc( RENDERSIZE, sizeof(char));
char * tmp = calloc( RENDERMINSIZE, sizeof(char));
if (NULL == tmp) {
exit(could_not_allocate_memory);
}
size_t rendersize_tmp = RENDERSIZE-1;
size_t rendersize_tmp = RENDERMINSIZE;
const retmsg_t * startp = ret;
short int rc_is_valid = 1;


+ 3
- 3
src/helper/renderer/check_renderer_xml.c View File

@ -29,11 +29,11 @@ const char * renderer_xml ( const retmsg_t * ret, const char * xmlfile ) {
}
memset( res, '\0', RENDERSIZE);
*/
char * res = calloc(RENDERSIZE, sizeof(char));
char * res = calloc(RENDERMAXSIZE, sizeof(char));
if (NULL == res) {
exit(could_not_allocate_memory);
}
size_t rendersize_res = RENDERSIZE-1;
size_t rendersize_res = RENDERMAXSIZE;
const retmsg_t * startp = ret;
res=secstrcat(res, "<checkit_tiff_result>\n", &rendersize_res);
@ -122,7 +122,7 @@ const char * renderer_xml ( const retmsg_t * ret, const char * xmlfile ) {
res=secstrcat(res, "\n", & rendersize_res);
fprintf(f, "%s", res);
fclose(f);
memset( res, '\0', RENDERSIZE);
memset( res, '\0', RENDERMAXSIZE);
return res;
}


Loading…
Cancel
Save