diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-03-27 02:52:59 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-03-27 02:52:59 +0000 |
commit | 53f728a0aec357f22f04af2d8cceccac8ff4237b (patch) | |
tree | d9155666d0311bb103fe564aff7ba935489b5322 /src/main.c | |
parent | 12d19cccd284457be9f5be8fcdac5b9d9b894b3f (diff) |
just to be carfile, make sure to null terminate when using strncpy
git-svn-id: https://svn.musicpd.org/mpd/trunk@506 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c index 6fbb14d0b..ef6cf3a5e 100644 --- a/src/main.c +++ b/src/main.c @@ -331,11 +331,15 @@ int main(int argc, char * argv[]) { initTables(); initPlaylist(); - if(!options.dbFile) { + if(!options.dbFile) { strncpy(directorydb,playlistDir,MAXPATHLEN); + directorydb[MAXPATHLEN] = '\0'; strncat(directorydb,"/.mpddb",MAXPATHLEN-strlen(playlistDir)); } - else strncpy(directorydb,options.dbFile,MAXPATHLEN); + else { + strncpy(directorydb,options.dbFile,MAXPATHLEN); + directorydb[MAXPATHLEN] = '\0'; + } if(options.createDB>0 || readDirectoryDB()<0) { if(options.createDB<0) { ERROR("can't open db file and using \"--no-create-db\"" |