Loading...
--- Libc/Libc-763.13/secure/vsnprintf_chk.c
+++ Libc/Libc-1353.11.2/secure/vsnprintf_chk.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2007-2013 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
@@ -25,22 +25,18 @@
#include <stdio.h>
#include <stdarg.h>
#include <limits.h>
-
-extern void __chk_fail (void) __attribute__((__noreturn__));
-extern int __vsnprintf_chk (char * __restrict, size_t, int, size_t,
- const char * __restrict, va_list arg)
- __DARWIN_LDBL_COMPAT (__vsnprintf_chk);
+#include "secure.h"
int
-__vsnprintf_chk (char *s, size_t maxlen, int flags, size_t len,
+__vsnprintf_chk (char *dest, size_t len, int flags, size_t dstlen,
const char *format, va_list arg)
{
int done;
- if (maxlen > len)
- __chk_fail ();
+ if (__builtin_expect (dstlen < len, 0))
+ __chk_fail_overflow ();
- done = vsnprintf (s, maxlen, format, arg);
+ done = vsnprintf (dest, len, format, arg);
return done;
}