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

Seg-Fault in Windows on plugin-load-failure #1866

Closed
roebotron opened this issue Oct 27, 2020 · 1 comment
Closed

Seg-Fault in Windows on plugin-load-failure #1866

roebotron opened this issue Oct 27, 2020 · 1 comment

Comments

@roebotron
Copy link

On Windows, if loading of a plugin fails, mosquitto (version 1.6.12) crashs with segmentation fault.

I debugged my MinGW64 build and found:

security.c, line 31 ff:

void LIB_ERROR(void)
{
#ifdef WIN32
	char *buf;
	FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING /* <-- cause */,
			NULL, GetLastError(), LANG_NEUTRAL, (LPTSTR)&buf, 0, NULL);
	log__printf(NULL, MOSQ_LOG_ERR, "Load error: %s", buf);
	LocalFree(buf)

FORMAT_MESSAGE_FROM_STRING causes Windows to interpret the consecutive NULL as valid pointer...
Replaced by FORMAT_MESSAGE_FROM_SYSTEM, I've got a fancy message text.

As I can see, this is not a MinGW-triggered issue.

ralight added a commit that referenced this issue Oct 27, 2020
ralight added a commit that referenced this issue Oct 27, 2020
@ralight
Copy link
Contributor

ralight commented Oct 27, 2020

Thanks very much, I've pushed changes for the 1.6.x and develop branches.

@ralight ralight closed this as completed Nov 2, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants