Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions bin/xbps-create/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,13 @@ process_one_alternative(const char *altgrname, const char *val)
if (a == NULL)
die("xbps_array_create");
}
altfiles = strchr(val, ':') + 1;
assert(altfiles);
altfiles = strchr(val, ':');
if (altfiles == NULL) {
fprintf(stderr, "%s: WARNING: ignoring malformed alternative: %s\n", _PROGNAME, val);
if (alloc) xbps_object_release(d);
return;
}
altfiles++;

xbps_array_add_cstring(a, altfiles);
xbps_dictionary_set(d, altgrname, a);
Expand Down Expand Up @@ -540,7 +545,7 @@ ftw_cb(const char *fpath, const struct stat *sb, const struct dirent *dir UNUSED
xe->type = ENTRY_TYPE_FILES;
}

if (!xbps_file_sha256(xe->sha256, sizeof sha256, fpath))
if (!xbps_file_sha256(xe->sha256, sizeof xe->sha256, fpath))
die("failed to process hash for: %s", fpath);
xbps_dictionary_set_cstring(fileinfo, "sha256", xe->sha256);

Expand Down
2 changes: 1 addition & 1 deletion bin/xbps-pkgdb/check_pkg_alternatives.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ relpath(char *from, char *to)

for (up = -1, from--; from && *from; from = strchr(from + 1, '/'), up++);

rel = calloc(3 * up + strlen(p), sizeof(char));
rel = calloc(3 * up + strlen(p) + 1, sizeof(char));

while (up--)
strcat(rel, "../");
Expand Down
3 changes: 2 additions & 1 deletion lib/package_alternatives.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ left(const char *str)
static const char *
right(const char *str)
{
return strchr(str, ':') + 1;
const char *colon = strchr(str, ':');
return colon ? colon + 1 : NULL;
}

static const char *
Expand Down