#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/util.c,v 1.94 2004-06-15 23:05:06 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/util.c,v 1.95.2.1 2005-04-25 16:15:07 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
tok2strbuf(register const struct tok *lp, register const char *fmt,
register int v, char *buf, size_t bufsize)
{
- while (lp->s != NULL) {
- if (lp->v == v)
- return (lp->s);
- ++lp;
+ if (lp != NULL) {
+ while (lp->s != NULL) {
+ if (lp->v == v)
+ return (lp->s);
+ ++lp;
+ }
}
if (fmt == NULL)
fmt = "#%d";
register int rotbit; /* this is the bit we rotate through all bitpositions */
register int tokval;
- while (lp->s != NULL) {
+ while (lp->s != NULL && lp != NULL) {
tokval=lp->v; /* load our first value */
rotbit=1;
while (rotbit != 0) {