summaryrefslogtreecommitdiffstats
path: root/regress
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2022-05-30 01:29:09 +0200
committerDamien Miller <djm@mindrot.org>2022-05-30 01:29:20 +0200
commitdc7bc52372f2744fa39191577be5306ee57aacd4 (patch)
tree4cce67eb6e246e6796908c2144581f495cbd736f /regress
parentTest against OpenSSL 1.1.1o and 3.0.3. (diff)
downloadopenssh-dc7bc52372f2744fa39191577be5306ee57aacd4.tar.xz
openssh-dc7bc52372f2744fa39191577be5306ee57aacd4.zip
fix some bugs in the fuzzer
Diffstat (limited to 'regress')
-rw-r--r--regress/misc/fuzz-harness/authkeys_fuzz.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/regress/misc/fuzz-harness/authkeys_fuzz.cc b/regress/misc/fuzz-harness/authkeys_fuzz.cc
index 6fe001fac..8b3e54e54 100644
--- a/regress/misc/fuzz-harness/authkeys_fuzz.cc
+++ b/regress/misc/fuzz-harness/authkeys_fuzz.cc
@@ -49,9 +49,14 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
}
if (cp == NULL || pw == NULL || key == NULL || cert == NULL)
abort();
+
+ // Cleanup whitespace at input EOL.
+ for (; size > 0 && strchr(" \t\r\n", data[size - 1]) != NULL; size--) ;
+
+ // Append a pubkey that will match.
memcpy(cp, data, size);
cp[size] = ' ';
- memcpy(cp + size + 1, key, strlen(pubkey) + 1);
+ memcpy(cp + size + 1, pubkey, strlen(pubkey) + 1);
// Try key.
if ((tmp = strdup(cp)) == NULL)