aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Woodward2005-01-10 19:52:54 +0000
committerJason Woodward2005-01-10 19:52:54 +0000
commit246039720152b6846539e346535bb3461a3dadc4 (patch)
tree62b8507db8315526721390197b76ae1ec819ac80 /src
parent776b613cac0f7a5cc30969ec5ee7cc970dac51a8 (diff)
downloadslapt-get-246039720152b6846539e346535bb3461a3dadc4.tar.gz
added 1 extra char to strndup() call and hard coded \0 at the end of exclude strings
Diffstat (limited to 'src')
-rw-r--r--src/configuration.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/configuration.c b/src/configuration.c
index 5f7e418..a4a324a 100644
--- a/src/configuration.c
+++ b/src/configuration.c
@@ -203,8 +203,9 @@ static struct exclude_list *parse_exclude(char *line){
if( realloc_tmp != NULL ){
list->excludes = realloc_tmp;
list->excludes[ list->count ] = strndup(
- pointer, strlen(pointer)
+ pointer, strlen(pointer) + 1
);
+ list->excludes[ list->count ][strlen(pointer)] = '\0';
++list->count;
}
@@ -219,13 +220,14 @@ static struct exclude_list *parse_exclude(char *line){
pointer = strchr(line + position,',');
buffer = strndup(
line + position,
- strlen(line + position) - strlen(pointer)
+ strlen(line + position) - strlen(pointer) + 1
);
realloc_tmp = realloc( list->excludes, sizeof *list->excludes * (list->count + 1) );
if( realloc_tmp != NULL ){
list->excludes = realloc_tmp;
list->excludes[ list->count ] = buffer;
+ list->excludes[ list->count ][strlen(buffer)] = '\0';
}
++list->count;