From: Jim Meyering Date: Thu, 21 Feb 2008 18:22:45 +0000 (+0000) Subject: Handle failed openvzLocateConfDir. X-Git-Tag: LIBVIRT_0_4_1~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5fc07cd840ba3639801649ae455a819a64b1fc2a;p=thirdparty%2Flibvirt.git Handle failed openvzLocateConfDir. * src/openvz_conf.c (openvzLocateConfDir, openvzGetVPSUUID): (openvzSetUUID): Don't dereference NULL upon failure. --- diff --git a/ChangeLog b/ChangeLog index 84d3e9d91c..54ac292ee4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Feb 21 19:22:10 CET 2008 Jim Meyering + + Handle failed openvzLocateConfDir. + * src/openvz_conf.c (openvzLocateConfDir, openvzGetVPSUUID): + (openvzSetUUID): Don't dereference NULL upon failure. + Thu Feb 21 15:17:00 UTC 2008 Richard W.M. Jones Fix double-free in OpenVZ driver. diff --git a/src/openvz_conf.c b/src/openvz_conf.c index 0bc7084b90..79d1e90f56 100644 --- a/src/openvz_conf.c +++ b/src/openvz_conf.c @@ -638,6 +638,8 @@ openvzGetVPSUUID(int vpsid, char *uuidstr) int fd, ret; conf_dir = openvzLocateConfDir(); + if (conf_dir == NULL) + return -1; sprintf(conf_file, "%s/%d.conf", conf_dir, vpsid); free(conf_dir); @@ -678,6 +680,8 @@ openvzSetUUID(int vpsid) int fd, ret; conf_dir = openvzLocateConfDir(); + if (conf_dir == NULL) + return -1; sprintf(conf_file, "%s/%d.conf", conf_dir, vpsid); free(conf_dir); @@ -719,6 +723,8 @@ int openvzAssignUUIDs(void) char ext[8]; conf_dir = openvzLocateConfDir(); + if (conf_dir == NULL) + return -1; dp = opendir(conf_dir); if(dp == NULL) {