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

4.0.x - crash when reading config file - configuration item with no value #3008

Closed
nchaigne opened this issue Sep 25, 2019 · 7 comments
Closed

Comments

@nchaigne
Copy link
Contributor

Issue type

  • Defect - Crash or memory corruption.

Defect

When reading configuration from file, a configuration error can crash the server:
If it's a known configuration item, but no value is provided (it should be an error but not crash).

Crash occurs in function cf_pair_parse_value (line 161 file cf_parse.c) here (because cp->value is NULL):

	if ((cp->value[0] == '\0') && cant_be_empty) {
@nchaigne
Copy link
Contributor Author

Mmh that's not sufficient... now I have another crash, still in cf_pair_parse_value:

*(uint64_t *)out = strtoull(cp->value, NULL, 0);

@alandekok
Copy link
Member

alandekok commented Sep 25, 2019 via email

@nchaigne
Copy link
Contributor Author

That's not a coding error, but a configuration error (not the default which is fine).
I agree it won't happen if the configuration is correct. But if is not, it's better if the server don't crash. :)

@nchaigne
Copy link
Contributor Author

There are other issues maybe related to this. For example if you configure module linelog with (an obvious configuration error):

file {
    #filename = ${logdir}/linelog
    filename
}

Then the server crashes (because xlat_tokenize_literal is called with NULL "fmt").
I have the backtrace for this case, if it can help ?

@alandekok
Copy link
Member

Hmm... OK. I'll put in patches then for this. The short answer (as always) is "don't do that" :)

@alandekok alandekok reopened this Sep 25, 2019
@nchaigne
Copy link
Contributor Author

Yes of course. I just accidentally botched the configuration and noticed the crash, I was not trying to make it happen :)

@nchaigne
Copy link
Contributor Author

Rebuilt with latest HEAD, confirm issue is fixed.
Thanks!

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

No branches or pull requests

2 participants