From 6cc248029c495f67e43aef1c989eb9559ad57bb5 Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Thu, 18 Oct 2007 12:19:11 +0000 Subject: [PATCH] sanity check before trying to set parameters --- src/varcache.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/varcache.c b/src/varcache.c index 7ba2175..acf6001 100644 --- a/src/varcache.c +++ b/src/varcache.c @@ -106,10 +106,19 @@ static int apply_var(PktBuf *pkt, const char *key, if (strcasecmp(cval, sval) == 0) return 0; + /* sanity check */ + if (!*cval || !*sval) { + /* parameters that can change should be always set */ + log_warning("Parameter unset: key='%s' client='%s' server='%s'", + key, cval, sval); + return 0; + } + /* the string may have been taken from startup pkt */ if (!quote_literal(qbuf, sizeof(qbuf), cval, std_quote)) return 0; + /* add SET statement to packet */ len = snprintf(buf, sizeof(buf), "SET %s=%s;", key, qbuf); if (len < sizeof(buf)) { pktbuf_put_bytes(pkt, buf, len); -- 2.40.0