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

Use target size limit in strncpy() in adapter.c. #1

Conversation

petterreinholdtsen
Copy link

This fixes the following compiler warnings and potentially avoid a buffer overflow:

adapter.c: In function ‘getAdapterConfig3’:
adapter.c:510:63: warning: argument to ‘sizeof’ in ‘strncpy’ call is the same expression as the source; did you mean to use the size of the destination? [-Wsizeof-pointer-memaccess]
510 | strncpy (a->product, (char *) pinfo->product_name, sizeof (pinfo->product_name));
| ^
adapter.c: In function ‘getAdapterConfig5’:
adapter.c:668:63: warning: argument to ‘sizeof’ in ‘strncpy’ call is the same expression as the source; did you mean to use the size of the destination? [-Wsizeof-pointer-memaccess]
668 | strncpy (a->product, (char *) pinfo->product_name, sizeof (pinfo->product_name));
| ^

This fixes the following compiler warnings and potentially avoid a buffer overflow:

adapter.c: In function ‘getAdapterConfig3’:
adapter.c:510:63: warning: argument to ‘sizeof’ in ‘strncpy’ call is the same expression as the source; did you mean to use the size of the destination? [-Wsizeof-pointer-memaccess]
  510 |     strncpy (a->product, (char *) pinfo->product_name, sizeof (pinfo->product_name));
      |                                                               ^
adapter.c: In function ‘getAdapterConfig5’:
adapter.c:668:63: warning: argument to ‘sizeof’ in ‘strncpy’ call is the same expression as the source; did you mean to use the size of the destination? [-Wsizeof-pointer-memaccess]
  668 |     strncpy (a->product, (char *) pinfo->product_name, sizeof (pinfo->product_name));
      |                                                               ^
@petterreinholdtsen
Copy link
Author

This package has been requested for Debian https://bugs.debian.org/1065322 . Are you still maintaining the software package?

@namiltd namiltd merged commit 6690bf1 into namiltd:master Mar 3, 2024
@namiltd
Copy link
Owner

namiltd commented Mar 3, 2024

I developed the package only on the equipment I had and on which I noticed problems with its operation.

@petterreinholdtsen petterreinholdtsen deleted the namiltd-master-adaptor-strncpy-warning branch March 3, 2024 09:49
@petterreinholdtsen
Copy link
Author

petterreinholdtsen commented Mar 3, 2024 via email

@namiltd
Copy link
Owner

namiltd commented Mar 3, 2024

I enabled https://github.com/namiltd/megactl/issues
However, it will be difficult for me to check the patches for equipment that I do not have and cannot test their operation.

@petterreinholdtsen
Copy link
Author

petterreinholdtsen commented Mar 3, 2024 via email

@namiltd
Copy link
Owner

namiltd commented Mar 3, 2024

I think it should be based on https://github.com/hmage/megactl and post all patches there, including those from my repository. The last version there is 0.4.3-hmage, it's time for 0.4.4.

@petterreinholdtsen
Copy link
Author

petterreinholdtsen commented Mar 3, 2024 via email

@petterreinholdtsen
Copy link
Author

petterreinholdtsen commented Mar 3, 2024 via email

@namiltd
Copy link
Owner

namiltd commented Mar 3, 2024

It is also worth mentioning that the application works with phpSysinfo, a package for displaying information about your system, which is also included in Debian.

@petterreinholdtsen
Copy link
Author

petterreinholdtsen commented Mar 3, 2024 via email

@saz
Copy link

saz commented Mar 4, 2024

@petterreinholdtsen I've read your blog post and wasn't able to find a good way to contact you. Anyways, maybe https://hwraid.le-vert.net/ is also worth a look.

@petterreinholdtsen
Copy link
Author

petterreinholdtsen commented Mar 4, 2024 via email

@petterreinholdtsen
Copy link
Author

petterreinholdtsen commented Mar 7, 2024 via email

@namiltd
Copy link
Owner

namiltd commented Mar 7, 2024

I have not received any information from Eugene/hmage
Speaking of sourceforge, it's not a problem for me.

@petterreinholdtsen
Copy link
Author

petterreinholdtsen commented Mar 7, 2024 via email

@petterreinholdtsen
Copy link
Author

petterreinholdtsen commented Mar 11, 2024 via email

@namiltd
Copy link
Owner

namiltd commented Mar 11, 2024

Done: https://github.com/namiltd/megactl/releases/tag/v0.4.4

I also turned on Discussions to make communication easier: https://github.com/namiltd/megactl/discussions

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

3 participants