Bugfix: Correctly fill the buffer with zeros

next
Michael Stapelberg 2011-11-09 22:23:33 +00:00
parent 332dbfe9c1
commit 6bdd12a584
1 changed files with 1 additions and 0 deletions

View File

@ -413,6 +413,7 @@ int main(int argc, char *argv[]) {
LOG("CORE DUMPS: Your current working directory is \"%s\".\n", cwd);
int patternfd;
if ((patternfd = open("/proc/sys/kernel/core_pattern", O_RDONLY)) >= 0) {
memset(cwd, '\0', sizeof(cwd));
if (read(patternfd, cwd, sizeof(cwd)) > 0)
/* a trailing newline is included in cwd */
LOG("CORE DUMPS: Your core_pattern is: %s", cwd);