summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/dh.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/dh.c b/src/dh.c
index 0d46c59..997ae85 100644
--- a/src/dh.c
+++ b/src/dh.c
@@ -45,6 +45,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#ifndef _WIN32
#include <netinet/in.h>
@@ -256,6 +257,10 @@ char *ssh_get_hexa(const unsigned char *what, size_t len) {
size_t i;
size_t hlen = len * 3;
+ if (len > (UINT_MAX - 1) / 3) {
+ return NULL;
+ }
+
hexa = malloc(hlen + 1);
if (hexa == NULL) {
return NULL;