From f56569b091f3b2f7fa0e8f08d17143f8e6659e8d Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Thu, 25 Oct 2018 13:50:36 +0300 Subject: [PATCH] lib-lua: Use source instead of short_src 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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib-lua/dlua-dovecot.c b/src/lib-lua/dlua-dovecot.c index e80b40e752..2950489806 100644 --- a/src/lib-lua/dlua-dovecot.c +++ b/src/lib-lua/dlua-dovecot.c @@ -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 = ""; + else if ((ptr = strrchr(ar.source, '/')) == NULL) + ptr = ar.source; else ptr++; *file_r = ptr; -- 2.47.3