diff --git a/ChangeLog b/ChangeLog index 2c5a790d59d3828b9c2c9fe45532812b1a29653e..32f93689d8c8b2caa607662a2879a6de20979707 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Thu May 7 09:26:50 CEST 2009 Guido Günther + + * src/util.c (virFileWritePid): check for NULL pointers + to avoid bogus pid files + (virFileReadPid): likewise + (virFileDeletePid): likewise + Thu May 7 09:24:47 CEST 2009 Daniel Veillard * src/domain_conf.c src/domain_conf.h: parse and save multiple diff --git a/src/util.c b/src/util.c index 47a1cd3f458279cedb8848a97c7ed800a4229764..c5edc9d96ef346b289dcf24fd11930f30ec4df65 100644 --- a/src/util.c +++ b/src/util.c @@ -1165,6 +1165,11 @@ int virFileWritePid(const char *dir, FILE *file = NULL; char *pidfile = NULL; + if (name == NULL || dir == NULL) { + rc = EINVAL; + goto cleanup; + } + if ((rc = virFileMakePath(dir))) goto cleanup; @@ -1212,6 +1217,11 @@ int virFileReadPid(const char *dir, char *pidfile = NULL; *pid = 0; + if (name == NULL || dir == NULL) { + rc = EINVAL; + goto cleanup; + } + if (!(pidfile = virFilePid(dir, name))) { rc = ENOMEM; goto cleanup; @@ -1246,6 +1256,11 @@ int virFileDeletePid(const char *dir, int rc = 0; char *pidfile = NULL; + if (name == NULL || dir == NULL) { + rc = EINVAL; + goto cleanup; + } + if (!(pidfile = virFilePid(dir, name))) { rc = ENOMEM; goto cleanup;