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;
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
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);