summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 980abcf)
raw | patch | inline | side by side (parent: 980abcf)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Fri, 3 Oct 2008 21:11:47 +0000 (23:11 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Fri, 3 Oct 2008 21:13:19 +0000 (23:13 +0200) |
Resolves: #20
src/utils_ignorelist.c | patch | blob | history |
diff --git a/src/utils_ignorelist.c b/src/utils_ignorelist.c
index 1d9467fe210d89e6ce0f9c6537e3be9e389d6e8e..689b4a42fd7c506f7dd4a4321071a62e9a9705c0 100644 (file)
--- a/src/utils_ignorelist.c
+++ b/src/utils_ignorelist.c
if ((entry_len > 2) && (entry[0] == '/') && entry[entry_len - 1] == '/')
{
char *entry_copy;
+ size_t entry_copy_size;
/* We need to copy `entry' since it's const */
- entry_copy = smalloc (entry_len);
- memset (entry_copy, '\0', entry_len);
- strncpy (entry_copy, entry + 1, entry_len - 2);
+ entry_copy_size = entry_len - 1;
+ entry_copy = smalloc (entry_copy_size);
+ strncpy (entry_copy, entry + 1, entry_copy_size);
+ entry_copy[entry_copy_size - 1] = 0;
DEBUG("I'm about to add regex entry: %s", entry_copy);
ret = ignorelist_append_regex(il, entry_copy);