]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/string.c
Prevent underflow (unlikely, but possible)
[thirdparty/cups.git] / cups / string.c
index 39a787f0ec427f459ad21c19865878186f43b88e..0d4ed0f50e4d54dce0f7fe92d2a78b1c5992d727 100644 (file)
@@ -695,10 +695,11 @@ _cups_strlcat(char       *dst,            /* O - Destination string */
   */
 
   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...