summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2013-10-04 17:21:49 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2013-10-04 19:15:49 +0200
commitef6959d8320c1b530a4b20a351055fe030b36e23 (patch)
tree9f3dbb50d87310adcef859e6aa41a6295810f47b
parentb57de388c15ddf17deca4d55e35b64d4828637aa (diff)
downloadgnutls-ef6959d8320c1b530a4b20a351055fe030b36e23.tar.gz
Fix srptool issues
From dc3a0d6d8d4aa98ccb19641e6668a03d77f381f1 Mon Sep 17 00:00:00 2001 From: Attila Molnar <attilamolnar@hush.com> Date: Tue, 1 Oct 2013 13:42:10 +0200 Subject: [PATCH 2/2] srptool: Fix segfault when an invalid group parameter index is given If no group with the given index was found in the password conf file srptool crashed instead of reporting the error because the return value of fgets() wasn't validated before it was passed to atoi(). Signed-off-by: Attila Molnar <attilamolnar@hush.com>
-rw-r--r--src/srptool.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/srptool.c b/src/srptool.c
index a0cfef10aa..f50264cc91 100644
--- a/src/srptool.c
+++ b/src/srptool.c
@@ -572,9 +572,8 @@ crypt_int (const char *username, const char *passwd, int salt_size,
do
{ /* find the specified uindex in file */
p = fgets (line, sizeof (line) - 1, fd);
- iindex = atoi (p);
}
- while (p != NULL && iindex != uindex);
+ while (p != NULL && (iindex = atoi (p)) != uindex);
if (p == NULL)
{