implemented a couple of minor stronger bounds checks
This commit is contained in:
@@ -88,6 +88,11 @@ parse_time_offset(const char *offset_str)
|
||||
if (isdigit(offset_str[i])) {
|
||||
offset_digits[j] = offset_str[i];
|
||||
j++;
|
||||
if(j >= MAX_TIME_STR_LEN)
|
||||
{
|
||||
fprintf(stderr, "Invalid time offset: %s", offset_str);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
} else if (offset_str[i] == 'm' || offset_str[i] == 'M') {
|
||||
offset_type = TIME_OFFSET_MINUTES;
|
||||
break;
|
||||
|
||||
@@ -46,9 +46,9 @@
|
||||
|
||||
struct url
|
||||
{
|
||||
char port[6];
|
||||
char host[256];
|
||||
char path[1024];
|
||||
char port[MAX_PORT_STR_LEN];
|
||||
char host[MAX_URL_HOST_LEN+1];
|
||||
char path[MAX_URL_PATH_LEN+1];
|
||||
};
|
||||
|
||||
static int
|
||||
|
||||
@@ -147,7 +147,7 @@ send_spa_packet_tcp_or_udp(const char *spa_data, const int sd_len,
|
||||
hints.ai_protocol = IPPROTO_TCP;
|
||||
}
|
||||
|
||||
sprintf(port_str, "%d", options->spa_dst_port);
|
||||
snprintf(port_str, MAX_PORT_STR_LEN, "%d", options->spa_dst_port);
|
||||
|
||||
error = getaddrinfo(options->spa_server_str, port_str, &hints, &result);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user