]> git.saurik.com Git - apple/xnu.git/blobdiff - libsyscall/mach/string.c
xnu-4570.1.46.tar.gz
[apple/xnu.git] / libsyscall / mach / string.c
index e1555b49dcca84c88ee048cde879376b83c1bb83..8dca9927cd90d62450a9ef78c9a55fdd635952be 100644 (file)
@@ -104,8 +104,9 @@ _mach_vsnprintf(char *buffer, int length, const char *fmt, va_list ap)
                        }
                }
        }
-       *out_ptr = '\0';
-       return max - length;
+       if (max > 0)
+               *out_ptr = '\0';
+       return max - (length + 1); /* don't include the final NULL in the return value */
 }
 
 int