Permalink
Browse files

Fixing overflow error.

  • Loading branch information...
1 parent 20c031d commit 96b9036cfbc11a0ede6b3a402da941a02274f5a6 Yevgen Antymyrov committed May 1, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 gd_interface.c
View
@@ -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");

0 comments on commit 96b9036

Please sign in to comment.