diff options
Diffstat (limited to '')
-rw-r--r-- | libgamma_behex_edid_lowercase.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libgamma_behex_edid_lowercase.c b/libgamma_behex_edid_lowercase.c index 9c4f04e..41a2563 100644 --- a/libgamma_behex_edid_lowercase.c +++ b/libgamma_behex_edid_lowercase.c @@ -17,6 +17,10 @@ libgamma_behex_edid_lowercase(const unsigned char *restrict edid, size_t length) size_t i; /* Allocate memory area for the output string */ + if (length > (SIZE_MAX / sizeof(char) - 1) / 2) { + errno = ENOMEM; + return NULL; + } out = malloc((length * 2 + 1) * sizeof(char)); if (!out) return NULL; |