]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/hash.c
Fix potential unaligned accesses in the string pool (Issue #5474)
[thirdparty/cups.git] / cups / hash.c
index aa6aca310fb0c913aa7ae360d5856d62d03333e5..061486076ca405978b33941838f0d0c40e1088f4 100644 (file)
@@ -1,15 +1,10 @@
 /*
  * Hashing function for CUPS.
  *
- * Copyright 2015-2017 by Apple Inc.
+ * Copyright © 2015-2019 by Apple Inc.
  *
- * 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.
  */
 
 /*
@@ -22,7 +17,7 @@
 #elif defined(HAVE_GNUTLS)
 #  include <gnutls/crypto.h>
 #else
-#  include "md5-private.h"
+#  include "md5-internal.h"
 #endif /* __APPLE__ */
 
 
@@ -235,7 +230,7 @@ cupsHashData(const char    *algorithm,      /* I - Algorithm name */
 
     gnutls_hash_fast(alg, data, datalen, hash);
 
-    return (gnutls_hash_get_len(alg));
+    return ((ssize_t)gnutls_hash_get_len(alg));
   }
 
 #else
@@ -280,6 +275,8 @@ cupsHashData(const char    *algorithm,      /* I - Algorithm name */
  * 'cupsHashString()' - Format a hash value as a hexadecimal string.
  *
  * The passed buffer must be at least 2 * hashsize + 1 characters in length.
+ *
+ * @since CUPS 2.2.7@
  */
 
 const char *                           /* O - Formatted string */