When iterating through the database, kdb would dereference a
null pointer if it encountered an error retrieving the value
or if the value was not the right length, in code that was clearly
cut-and-pasted from the other branch of an "if" statement where a
specific entry was requested on the command line. Print the name
of the entry with the problem as was apparently intended.
Change-Id: Idc2d3c9b6049e5d3b0eb302353a68bcfdad6a90d
Found-by: clang static analyzer
Reviewed-on: http://gerrit.openafs.org/5174
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
if (as->parms[2].items) {
data = dbm_fetch(kdb, key);
if (!data.dptr) {
- fprintf(stderr, "%s: no entry exists\n", ti->data);
+ fprintf(stderr, "%s: no entry exists\n", (char *)key.dptr);
continue;
}
if (data.dsize != sizeof(kalog_elt)) {
- fprintf(stderr, "%s: data came out corrupt\n", ti->data);
+ fprintf(stderr, "%s: data came out corrupt\n",
+ (char *)key.dptr);
continue;
}
memcpy(&rdata, data.dptr, sizeof(kalog_elt));