Skip to content

Commit

Permalink
Fix for issue #1
Browse files Browse the repository at this point in the history
  • Loading branch information
Lochnair committed Nov 23, 2016
1 parent 4aca339 commit 96588b6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/xt_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,11 @@ static int get_ssl_hostname(const struct sk_buff *skb, char **dest)
printk("[xt_ssl] Name type: %d\n", name_type);
printk("[xt_ssl] Name length: %d\n", name_length);
#endif
*dest = kmalloc(name_length, GFP_KERNEL);
// Allocate an extra byte for the null-terminator
*dest = kmalloc(name_length + 1, GFP_KERNEL);
strncpy(*dest, &data[offset + extension_offset], name_length);
// Make sure the string is always null-terminated.
(*dest)[name_length] = 0;

return 0;
}
Expand Down

0 comments on commit 96588b6

Please sign in to comment.