* Copyright 2007-2014 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
- * These coded instructions, statements, and computer programs are the
- * property of Apple Inc. and are protected by Federal copyright
- * law. Distribution and use rights are outlined in the file "LICENSE.txt"
- * which should have been included with this file. If this file is
- * missing or damaged, see the license at "http://www.cups.org/".
- *
- * This file is subject to the Apple OS-Developed Software exception.
+ * Licensed under Apache License v2.0. See the file "LICENSE" for more information.
*/
/*
*/
dstlen = strlen(dst);
- size -= dstlen + 1;
- if (!size)
- return (dstlen); /* No room, return immediately... */
+ if (size < (dstlen + 1))
+ return (dstlen); /* No room, return immediately... */
+
+ size -= dstlen + 1;
/*
* Figure out how much room is needed...