-/* $OpenBSD: pch.c,v 1.64 2023/07/12 11:26:13 tb Exp $ */
+/* $OpenBSD: pch.c,v 1.65 2023/07/12 15:44:47 florian Exp $ */
/*
* patch - a program to apply diffs to original files
{
size_t min_components, min_baselen, min_len, tmp;
char *best = NULL;
- char *path;
+ char *path, *bn;
int i;
/*
min_components = tmp;
best = path;
}
- if ((tmp = strlen(basename(path))) > min_baselen)
+ bn = basename(path);
+ if (bn == NULL)
+ continue;
+ if ((tmp = strlen(bn)) > min_baselen)
continue;
if (tmp < min_baselen) {
min_baselen = tmp;