aboutsummaryrefslogtreecommitdiff
path: root/src/dh.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dh.c')
-rw-r--r--src/dh.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/dh.c b/src/dh.c
index ec291d33..9b9d2039 100644
--- a/src/dh.c
+++ b/src/dh.c
@@ -44,6 +44,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#ifndef _WIN32
#include <netinet/in.h>
@@ -194,6 +195,9 @@ char *ssh_get_hexa(const unsigned char *what, size_t len) {
char *hexa = NULL;
size_t i;
+ if (len > (UINT_MAX - 1) / 3)
+ return NULL;
+
hexa = malloc(len * 3 + 1);
if (hexa == NULL) {
return NULL;