]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - fs/coredump.c
coredump: fix va_list corruption
[karo-tx-linux.git] / fs / coredump.c
index e3ad709a4232f414b91fe1ed18989a07d0f7aaa3..0b2528fb640e77e4a38a351c51f8a01f12102c14 100644 (file)
@@ -73,10 +73,15 @@ static int expand_corename(struct core_name *cn, int size)
 static int cn_vprintf(struct core_name *cn, const char *fmt, va_list arg)
 {
        int free, need;
+       va_list arg_copy;
 
 again:
        free = cn->size - cn->used;
-       need = vsnprintf(cn->corename + cn->used, free, fmt, arg);
+
+       va_copy(arg_copy, arg);
+       need = vsnprintf(cn->corename + cn->used, free, fmt, arg_copy);
+       va_end(arg_copy);
+
        if (need < free) {
                cn->used += need;
                return 0;