From: Kristian Høgsberg Date: Thu, 6 Mar 2008 05:27:43 +0000 (-0500) Subject: Fix bug in razor_create_dir() path component loop. X-Git-Tag: 0.1~212 X-Git-Url: http://project.juiblex.co.uk/git/?a=commitdiff_plain;h=80e23541afcdc2100a6cf20450e44d0c9257ebb8;p=razor2.git%2F.git Fix bug in razor_create_dir() path component loop. --- diff --git a/rpm.c b/rpm.c index 0e8a7c3..255aa35 100644 --- a/rpm.c +++ b/rpm.c @@ -526,7 +526,6 @@ razor_importer_add_rpm(struct razor_importer *importer, struct razor_rpm *rpm) { const char *name, *version, *release; const uint_32 *epoch; - struct rpm_header_index *epoch_header; char evr[128], buf[16]; name = razor_rpm_get_indirect(rpm, RPMTAG_NAME, NULL); @@ -534,7 +533,7 @@ razor_importer_add_rpm(struct razor_importer *importer, struct razor_rpm *rpm) version = razor_rpm_get_indirect(rpm, RPMTAG_VERSION, NULL); release = razor_rpm_get_indirect(rpm, RPMTAG_RELEASE, NULL); - if (epoch_header) { + if (epoch) { snprintf(buf, sizeof buf, "%u", ntohl(*epoch)); razor_build_evr(evr, sizeof evr, buf, version, release); } else { diff --git a/util.c b/util.c index 2501f65..a48b77d 100644 --- a/util.c +++ b/util.c @@ -21,8 +21,11 @@ razor_create_dir(const char *root, const char *path) strcpy(buffer, root); p = buffer + strlen(buffer); slash = path; - for (slash = path; slash[1] != '\0'; slash = next) { + for (slash = path; *slash != '\0'; slash = next) { next = strchr(slash + 1, '/'); + if (next == NULL) + next = slash + strlen(slash); + memcpy(p, slash, next - slash); p += next - slash; *p = '\0';