Fix bug in razor_create_dir() path component loop.
authorKristian H?gsberg <krh@redhat.com>
Thu Mar 06 00:55:51 2008 -0500 (2008-03-06)
changeset 14943cac7931189
parent 148 ea06dacb3c04
child 150 b838d74663a7
Fix bug in razor_create_dir() path component loop.
rpm.c
util.c
     1.1 --- a/rpm.c	Wed Mar 05 23:49:05 2008 -0500
     1.2 +++ b/rpm.c	Thu Mar 06 00:55:51 2008 -0500
     1.3 @@ -526,7 +526,6 @@
     1.4  {
     1.5  	const char *name, *version, *release;
     1.6  	const uint_32 *epoch;
     1.7 -	struct rpm_header_index *epoch_header;
     1.8  	char evr[128], buf[16];
     1.9  
    1.10  	name = razor_rpm_get_indirect(rpm, RPMTAG_NAME, NULL);
    1.11 @@ -534,7 +533,7 @@
    1.12  	version = razor_rpm_get_indirect(rpm, RPMTAG_VERSION, NULL);
    1.13  	release = razor_rpm_get_indirect(rpm, RPMTAG_RELEASE, NULL);
    1.14  
    1.15 -	if (epoch_header) {
    1.16 +	if (epoch) {
    1.17  		snprintf(buf, sizeof buf, "%u", ntohl(*epoch));
    1.18  		razor_build_evr(evr, sizeof evr, buf, version, release);
    1.19  	} else {
     2.1 --- a/util.c	Wed Mar 05 23:49:05 2008 -0500
     2.2 +++ b/util.c	Thu Mar 06 00:55:51 2008 -0500
     2.3 @@ -21,8 +21,11 @@
     2.4  	strcpy(buffer, root);
     2.5  	p = buffer + strlen(buffer);
     2.6  	slash = path;
     2.7 -	for (slash = path; slash[1] != '\0'; slash = next) {
     2.8 +	for (slash = path; *slash != '\0'; slash = next) {
     2.9  		next = strchr(slash + 1, '/');
    2.10 +		if (next == NULL)
    2.11 +			next = slash + strlen(slash);
    2.12 +
    2.13  		memcpy(p, slash, next - slash);
    2.14  		p += next - slash;
    2.15  		*p = '\0';