Skip to content

Bugfixes#32

Merged
pilsnerfrajz merged 2 commits into
mainfrom
alarm-bug
Feb 1, 2026
Merged

Bugfixes#32
pilsnerfrajz merged 2 commits into
mainfrom
alarm-bug

Conversation

@pilsnerfrajz
Copy link
Copy Markdown
Owner

Bugfixes

This adds a fix for bugs related to alarm and a buffer size constant.

Alarm Bug

The addition of fingerprinting introduced a bug were an alarm was not reset which caused a segmentation fault.

sudo ./bin/disco 192.168.1.1 -p 1-100
[+] Host 192.168.1.1 is up!
[*] Scanning 100 port(s) on 192.168.1.1...
[1]    62647 segmentation fault  sudo ./bin/disco 192.168.1.1 -p 1-100

The bug was fixed by setting alarm(0) in arp.c.

Buffer Constant

The MAC address print buffer constant used the run-time function strlen instead of a compile-time operator like sizeof to calculate the size, creating a warning. Since the -Werror compiler flag is used, this throws an error.

make
src/main.c:198:9: error: variable length array folded to constant array as an extension [-Werror,-Wgnu-folding-constant]
  198 |         char m[MAC_PRINT_BUF_SIZE];
      |                ^~~~~~~~~~~~~~~~~~
src/main.c:18:29: note: expanded from macro 'MAC_PRINT_BUF_SIZE'
   18 | #define MAC_PRINT_BUF_SIZE (strlen("[+] MAC address: 00:xx:de:ad:be:ef") + 1)
      |                            ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [main.o] Error 1

By changing the constant to #define MAC_PRINT_BUF_SIZE (sizeof("[+] MAC address: 00:xx:de:ad:be:ef\n")) the error is fixed.

@pilsnerfrajz pilsnerfrajz added the bug Something isn't working label Feb 1, 2026
@pilsnerfrajz pilsnerfrajz merged commit 2f60181 into main Feb 1, 2026
5 checks passed
@pilsnerfrajz pilsnerfrajz deleted the alarm-bug branch February 1, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant