kuri pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=ec3d13d6c972448caae42d8da2f7d596d865479f

commit ec3d13d6c972448caae42d8da2f7d596d865479f
Author: Guillaume Friloux <k...@efl.so>
Date:   Fri Jan 3 19:13:30 2014 +0100

    eina - Fix compilation warning in eina_log_print_cb_journald.
    
    vasprintf can return -1, in which case the buffer is corrupted.
    So we better handle this ...
    
    gcc told me of this thanks to -Wunused-result when building package,
    thank you gcc for your incredible powers.
---
 src/lib/eina/eina_log.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/lib/eina/eina_log.c b/src/lib/eina/eina_log.c
index a123a77..c54c3ac 100644
--- a/src/lib/eina/eina_log.c
+++ b/src/lib/eina/eina_log.c
@@ -1907,8 +1907,14 @@ eina_log_print_cb_journald(const Eina_Log_Domain *d,
    char buf[12];
    char *tmp;
    Eina_Thread cur;
+   int r;
 
-   vasprintf(&tmp, fmt, args);
+   r = vasprintf(&tmp, fmt, args);
+   if (r == -1)
+     {
+        fputs("ERR: eina_log_print_cb_journald() vasprintf failed\n");
+        return;
+     }
 
    eina_convert_itoa(line, buf);
 

-- 


Reply via email to