-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/typepayload #200
Feature/typepayload #200
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Потенциально вылет за память
src/ev_mgr.c
Outdated
// Start TCP proxy client | ||
if(!(ke->tp->fd_client > 0)) | ||
if(ke->tp->fd_client == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0 - валидный дескриптор же, обычно он stdin. Не валидный fd == -1
if(ip_is_private(ips[i])) { | ||
int ip_len = strlen(ips[i]) + 1; | ||
memcpy(packet->ips + ptr, ips[i], ip_len); | ||
ptr += ip_len; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Проверить что len * MAX_IP_STR_LEN > ptr
Ассертить если не, это ошибка которая много и очень неочевидно сломает
src/ev_mgr.c
Outdated
// Start TCP proxy client | ||
if(!(ke->tp->fd_client > 0)) | ||
if(!(ke->tp->fd_client > 0)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(!(ke->tp->fd_client > 0)) { | |
if(ke->tp->fd_client < 0) { |
0 же валидный, а тут оно провалится
host_info_data *hid = teoGetHostInfo(event_manager, &hid_len); | ||
|
||
char *full_type = teoGetFullAppTypeFromHostInfo(hid); | ||
strncpy(packet->type, full_type, sizeof(packet->type)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Здесь как-то хочется проверять, что full_type влезает целиком в packet->type
А что делать, если не влезает? Выкидывать лишние типы? Писать, сколько влезет?
Может тогда ограничить размер full_type? Или неограниченный размер для packet->type.
src/net_com.c
Outdated
// Parse command data | ||
uint8_t *num_ip = rd->data; // Number of IPs | ||
connect_r_packet_t *packet = rd->data; | ||
printHexDump(packet, rd->data_len); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это, наверное, стоит либо убрать, либо под флаг отладочный унести
…ent-peer net_core.c: skip packet if peer not found
ev_mgr.c: resolve dns name before connect to r-host
#188