Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixing overflow error.

  • Loading branch information...
commit 96b9036cfbc11a0ede6b3a402da941a02274f5a6 1 parent 20c031d
Yevgen Antymyrov authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 gd_interface.c
View
6 gd_interface.c
@@ -151,7 +151,11 @@ char* load_file(const char* path, const char* name)
{
size_t pathlen = strlen(path);
size_t namelen = strlen(name);
- char *full_name = (char*) malloc(sizeof(char) * (pathlen + namelen));
+ size_t full_name_len = sizeof(char) * (pathlen + namelen) + 1;
+ char *full_name = (char*) malloc(full_name_len);
+
+ memset(full_name, 0, full_name_len);
+
if(full_name == NULL)
{
perror("malloc");
Please sign in to comment.
Something went wrong with that request. Please try again.