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