Skip to content
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

Merged
merged 19 commits into from
Apr 6, 2021
Merged

Feature/typepayload #200

merged 19 commits into from
Apr 6, 2021

Conversation

angelskieglazki
Copy link
Member

@angelskieglazki angelskieglazki added the enhancement New feature or request label Apr 5, 2021
@angelskieglazki angelskieglazki added this to the v0.4.7 milestone Apr 5, 2021
@angelskieglazki angelskieglazki self-assigned this Apr 5, 2021
Copy link
Contributor

@chernikovdmitry chernikovdmitry left a 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) {
Copy link
Contributor

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;
Copy link
Contributor

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)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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));
Copy link
Contributor

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это, наверное, стоит либо убрать, либо под флаг отладочный унести

@angelskieglazki angelskieglazki merged commit df045fd into develop Apr 6, 2021
Teonet library, applications, controls and components automation moved this from In Progress to Done Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

None yet

3 participants