-
Notifications
You must be signed in to change notification settings - Fork 17
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
fix(lib): do not insert "nulls" as values for __VARARGS__ config arguments #254
Conversation
On a second thought this might not be a proper fix:
The value gets lost somewhere 👀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I remember this only happens through multi-level passes of __VARARGS__
with empty values, so the real fix might be somewhere else and will be something about how we handle the empty string parameter passed through these varargs.
Another config that crashes at the same location:
|
d9e3d7f
to
bee1aee
Compare
Updated the PR to properly handle empty |
This is getting closer, it fixes the crash with the above config snippet but changes the output if you type I think the issue is in the lexer, it removes |
These are the ones removing what we need.
|
I can't fix this without reimplementing f0650bb completely, which would be a lot more work. syslog-ng/syslog-ng#2088 (comment) says the following:
Unfortunately, this is not so lucky with varargs. With the current implementation, it is impossible to pass an empty string parameter through So in order to fix the crash (but without making it possible to pass empty strings properly), I think we could go with this (which is very similar to your original patch, except for the new-line ending): diff --git a/lib/cfg-block-generator.c b/lib/cfg-block-generator.c
index 9374c58e8..00811f278 100644
--- a/lib/cfg-block-generator.c
+++ b/lib/cfg-block-generator.c
@@ -39,6 +39,7 @@ _report_generator_args(gpointer key, gpointer value, gpointer user_data)
{
GString *result = (GString *) user_data;
g_string_append_printf(result, "## %s=", (gchar *) key);
+ value = value ? : "";
for (const gchar *c = (const gchar *) value; *c; c++)
{
if (*c == '\n' && *(c + 1)) Because of this: axosyslog/lib/cfg-lexer-subst.c Line 257 in f074c0f
And we can open a separate issue about the impossibility to pass empty strings through varargs. |
This avoids crashing if `NULL` (==empty string) was passed as value. For details see #254 (comment)
bee1aee
to
f43071f
Compare
This avoids crashing if `NULL` (==empty string) was passed as value. For details see #254 (comment) Signed-off-by: Szilard Parrag <[email protected]>
f43071f
to
5f1e225
Compare
After the fix:
Fixes #244.