findbestmatchingname_fn(): only do something sensible if the pointer
handed in is actually usable (not NULL) Fixes Coverity ID 870
This commit is contained in:
parent
baf66cc3f1
commit
92acb1f6e9
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: str.c,v 1.58 2006/01/08 12:20:54 wiz Exp $ */
|
||||
/* $NetBSD: str.c,v 1.59 2006/03/17 02:10:55 hubertf Exp $ */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
|
@ -11,7 +11,7 @@
|
|||
#if 0
|
||||
static const char *rcsid = "Id: str.c,v 1.5 1997/10/08 07:48:21 charnier Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: str.c,v 1.58 2006/01/08 12:20:54 wiz Exp $");
|
||||
__RCSID("$NetBSD: str.c,v 1.59 2006/03/17 02:10:55 hubertf Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -318,11 +318,12 @@ findbestmatchingname_fn(const char *found, void *vp)
|
|||
} else {
|
||||
/* if best_version==NULL only if best==NULL
|
||||
* (or best[0]='\0') */
|
||||
if (best == NULL || best[0] == '\0' ||
|
||||
dewey_cmp(found_version, DEWEY_GT, best_version)) {
|
||||
/* found pkg(version) is bigger than current "best"
|
||||
* version - remember! */
|
||||
strcpy(best, found);
|
||||
if (best != NULL) {
|
||||
if (dewey_cmp(found_version, DEWEY_GT, best_version)) {
|
||||
/* found pkg(version) is bigger than current "best"
|
||||
* version - remember! */
|
||||
strcpy(best, found);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue