Skip to content

Conversation

sminux
Copy link

@sminux sminux commented Aug 30, 2025

A few fixes for #2257

smarchenkov added 4 commits August 30, 2025 12:26
After having been compared to a NULL value, pointer 'scur->protocol' is dereferenced by calling function 'strcat'.
Make return if getservbyname return 0, so we won't reach the strcpy call.

Signed-off-by: smarchenkov <[email protected]>
Pointer 'packet' is passed to a free function at seap-packet.c:51 by passing as 1st parameter to function 'SEAP_packet_free' at seap.c:220 after the referenced memory was deallocated at seap-packet.c:51 by passing as 1st parameter to function 'SEAP_packet_free' at seap.c:220. Note: the second deallocation is on another loop iteration.

Signed-off-by: smarchenkov <[email protected]>
Check for NULL pointer 'fp' returned from function 'fopen'

Signed-off-by: smarchenkov <[email protected]>
Signed-off-by: smarchenkov <[email protected]>
{
free(packet);
if (packet != NULL) {
free(packet);
Copy link
Contributor

Choose a reason for hiding this comment

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

Indentation.

fp = fopen("/proc/net/ipv6_route", "r");
if (fp == NULL) {
if (errno == ENOENT) {
dI("/proc/net/route does not exist. No IPv4 routing table available.");
Copy link
Contributor

Choose a reason for hiding this comment

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

IPv6.

if (service == NULL) {
return -1;
}
else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Newline.

dD("port not set, trying to guess from /etc/services for %s", scur->name);
if (service != NULL) {
if (service == NULL) {
return -1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Indentation.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also this change is breaking the logic of the probe. Test is failing.

if (service == NULL) {
return -1;
}
else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Newline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants