diff options
author | paul <paul> | 2008-02-28 23:26:02 +0000 |
---|---|---|
committer | paul <paul> | 2008-02-28 23:26:02 +0000 |
commit | 8bd8d860740dc0eefdc79d8ce26bb38cc780bc5c (patch) | |
tree | 8ce88e2291d49b08efefe62565900d7f45a3cdda /lib/log.h | |
parent | 3fd5ece7f5923e1722a29990a92afc60e27ecf07 (diff) | |
download | quagga-8bd8d860740dc0eefdc79d8ce26bb38cc780bc5c.tar.bz2 quagga-8bd8d860740dc0eefdc79d8ce26bb38cc780bc5c.tar.xz |
[lib] Fix the struct message LOOKUP function to be more robust
2008-02-28 Paul Jakma <paul.jakma@sun.com>
* log.c: (mes_lookup) Sowmini Varadhan diagnosed a problem where
this function can cause a NULL dereference, on lookups for unknown
indices, or messages with NULL strings. Can occur, e.g., debug
logging code when processing received messages. Fixed to accept a
pointer to a default string to be used if there is no match.
* log.h: LOOKUP adjusted to match
Diffstat (limited to 'lib/log.h')
-rw-r--r-- | lib/log.h | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -1,5 +1,5 @@ /* - * $Id: log.h,v 1.19 2007/04/28 22:14:10 ajs Exp $ + * $Id: log.h,v 1.20 2008/02/28 23:26:02 paul Exp $ * * Zebra logging funcions. * Copyright (C) 1997, 1998, 1999 Kunihiro Ishiguro @@ -142,10 +142,12 @@ extern int zlog_reset_file (struct zlog *zl); extern int zlog_rotate (struct zlog *); /* For hackey massage lookup and check */ -#define LOOKUP(x, y) mes_lookup(x, x ## _max, y) +#define LOOKUP(x, y) mes_lookup(x, x ## _max, y, "(no item found)") extern const char *lookup (struct message *, int); -extern const char *mes_lookup (struct message *meslist, int max, int index); +extern const char *mes_lookup (struct message *meslist, + int max, int index, + const char *no_item); extern const char *zlog_priority[]; extern const char *zlog_proto_names[]; |