]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-lua: Use source instead of short_src
authorAki Tuomi <aki.tuomi@dovecot.fi>
Thu, 25 Oct 2018 10:50:36 +0000 (13:50 +0300)
committerAki Tuomi <aki.tuomi@dovecot.fi>
Thu, 25 Oct 2018 10:50:36 +0000 (13:50 +0300)
short_src is a limited value, and also an byte array
instead of a pointer so it should not be returned.

Found by coverity.

src/lib-lua/dlua-dovecot.c

index 8aef36df896c834055da8f3ac75620ec1dac933c..7b29e96eff1925c1b9fb73f97de7860464345f38 100644 (file)
@@ -24,8 +24,10 @@ static void dlua_get_file_line(struct dlua_script *script, int arg,
        /* basename would be better, but basename needs memory
           allocation, since it might modify the buffer contents,
           so we use this which is good enough */
-       if ((ptr = strrchr(ar.short_src, '/')) == NULL)
-               ptr = ar.short_src;
+       if (ar.source[0] != '@')
+               ptr = "<non-file location>";
+       else if ((ptr = strrchr(ar.source, '/')) == NULL)
+               ptr = ar.source;
        else
                ptr++;
        *file_r = ptr;