commit e46fee23df79275cd897d51214a27391d3b822d6
Author: Oswald Buddenhagen <[email protected]>
Date:   Wed Mar 19 15:30:59 2025 +0100

    fix conditional on undefined value on some config syntax errors
    
    if the first token on a line was an unterminated escape/quote, we'd
    branch based on an uninitialized 'comment' variable.
    
    amends 725a122e.

 src/config.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/config.c b/src/config.c
index 3ea4837..6a98297 100644
--- a/src/config.c
+++ b/src/config.c
@@ -73,8 +73,8 @@ get_arg( conffile_t *cfile, int required, int *comment )
        while ((c = *p) && isspace( (uchar)c ))
                p++;
        if (!c || c == '#') {
-               if (comment)
-                       *comment = (c == '#');
+               if (comment && c)
+                       *comment = 1;
                if (required) {
                        error( "%s:%d: parameter missing\n", cfile->file, 
cfile->line );
                        cfile->err = 1;
@@ -313,7 +313,6 @@ int
 getcline( conffile_t *cfile )
 {
        char *arg;
-       int comment;
 
        if (cfile->rest && (arg = get_arg( cfile, ARG_OPTIONAL, NULL ))) {
                error( "%s:%d: excess token '%s'\n", cfile->file, cfile->line, 
arg );
@@ -322,6 +321,7 @@ getcline( conffile_t *cfile )
        while (fgets( cfile->buf, cfile->bufl, cfile->fp )) {
                cfile->line++;
                cfile->rest = cfile->buf;
+               int comment = 0;
                if (!(cfile->cmd = get_arg( cfile, ARG_OPTIONAL, &comment ))) {
                        if (comment)
                                continue;


_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to