fixed array access out of bounds
[r1406]
char *pos;
const char *digits = small_digits;
char *pos;
const char *digits = small_digits;
- pos = output_buffer + BIT_PATTERN_SIZE;
+ pos = output_buffer + BIT_PATTERN_SIZE ;
*pos = '\0';
/* special case */
*pos = '\0';
/* special case */
CALC_BUFFER_SIZE = (4 * precision_in_bytes);
MAX_VALUE_SIZE = (2 * precision_in_bytes);
CALC_BUFFER_SIZE = (4 * precision_in_bytes);
MAX_VALUE_SIZE = (2 * precision_in_bytes);
- calc_buffer = malloc(CALC_BUFFER_SIZE * sizeof(char));
- output_buffer = malloc(BIT_PATTERN_SIZE * sizeof(char));
+ calc_buffer = malloc(CALC_BUFFER_SIZE+1 * sizeof(char));
+ output_buffer = malloc(BIT_PATTERN_SIZE+1 * sizeof(char));
if (calc_buffer == NULL || output_buffer == NULL)
{
if (calc_buffer == NULL || output_buffer == NULL)
{
#include <assert.h> /* assertions */
#include <stdlib.h> /* atoi() */
#include <string.h> /* nice things for strings */
#include <assert.h> /* assertions */
#include <stdlib.h> /* atoi() */
#include <string.h> /* nice things for strings */
+#include <strings.h> /* nice things for strings */
#include <stdlib.h>
#include "tv_t.h"
#include <stdlib.h>
#include "tv_t.h"