Loading...
secure/vsprintf_chk.c Libc-1725.40.4 Libc-583
--- Libc/Libc-1725.40.4/secure/vsprintf_chk.c
+++ Libc/Libc-583/secure/vsprintf_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,21 +25,25 @@
 #include <stdio.h>
 #include <stdarg.h>
 #include <limits.h>
-#include "secure.h"
+
+extern void __chk_fail (void) __attribute__((__noreturn__));
+extern int __vsprintf_chk (char * __restrict, int, size_t,
+                           const char * __restrict, va_list arg)
+  __DARWIN_LDBL_COMPAT (__vsprintf_chk);
 
 int
-__vsprintf_chk (char *dest, int flags, size_t dstlen, const char *format,
+__vsprintf_chk (char *s, int flags, size_t len, const char *format,
 		va_list arg)
 {
   int done;
 
-  if (__builtin_expect (dstlen > (size_t) INT_MAX, 0))
-    done = vsprintf (dest, format, arg);
+  if (len > (size_t) INT_MAX)
+    done = vsprintf (s, format, arg);
   else
     {
-      done = vsnprintf (dest, dstlen, format, arg);
-      if (__builtin_expect (done >= 0 && (size_t) done >= dstlen, 0))
-        __chk_fail_overflow ();
+      done = vsnprintf (s, len, format, arg);
+      if (done >= 0 && (size_t) done >= len)
+	__chk_fail ();
     }
 
   return done;