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

Updated Bluetooth base structure in lib. #1607

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

MONDERASDOR
Copy link

I saw that the libbluetooth wasn't updated for a long time. And.i provided some Updates to it simply
It might be a simple thing but it might help as i hope.

This pull request introduces improvements to the Bluetooth utility functions in bluetooth.c and bluetooth.h. The changes focus on enhancing robustness, improving error handling, and ensuring compatibility with modern coding standards. Key updates include

  • Added error logging using perror for file operations like fopen to provide better debugging information when errors occur.
  • Ensured proper initialization of pointers, such as end in bt_aton, to prevent undefined behavior.
  • Added a retry counter in bt_gethostent to prevent infinite loops when parsing invalid lines in /etc/bluetooth/hosts.
  • Replaced sprintf with snprintf in bt_ntoa for safer string formatting.
  • Added declarations for internal utility functions (bt_hex_byte and bt_hex_nibble) to the header file for better code organization.
  • Improved input validation in bt_hex_byte and bt_hex_nibble to handle edge cases more gracefully.

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.

None yet

2 participants