]> eyrie.org Git - kerberos/krb5-strength.git/blobdiff - tools/heimdal-strength.c
Add dependabot configuration
[kerberos/krb5-strength.git] / tools / heimdal-strength.c
index 51416c7cbbbdb87a8e83e288fe06ce6137efef69..e44b7a45305e4b1f000643b395e559ec7c05b508 100644 (file)
@@ -6,11 +6,12 @@
  * interface.  It uses a krb5.conf parameter to determine the location of its
  * dictionary.
  *
- * Written by Russ Allbery <rra@stanford.edu>
+ * Written by Russ Allbery <eagle@eyrie.org>
+ * Copyright 2020 Russ Allbery <eagle@eyrie.org>
  * Copyright 2009, 2013
  *     The Board of Trustees of the Leland Stanford Junior University
  *
- * See LICENSE for licensing terms.
+ * SPDX-License-Identifier: MIT
  */
 
 #include <config.h>
@@ -21,8 +22,8 @@
 
 #include <plugin/internal.h>
 #include <util/macros.h>
-#include <util/messages.h>
 #include <util/messages-krb5.h>
+#include <util/messages.h>
 #include <util/xmalloc.h>
 
 
@@ -35,8 +36,9 @@ static void
 read_key(const char *key, char *buffer, size_t length)
 {
     char *p;
+    int size = (length < INT_MAX) ? (int) length : INT_MAX;
 
-    if (fgets(buffer, length, stdin) == NULL)
+    if (fgets(buffer, size, stdin) == NULL)
         sysdie("Cannot read %s", key);
     if (strlen(buffer) < 1 || buffer[strlen(buffer) - 1] != '\n')
         die("Malformed or too long %s line", key);