diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2007-09-10 12:41:13 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2007-09-10 12:41:13 +0000 |
commit | e6913c77fc1da39e3bf37225d21d8ce4b2429e24 (patch) | |
tree | 1861f0d571afe2c13ca8042579003c27cfd478bc /syslogd.c | |
parent | 0fa199ef69450a16cf6df01e0644523827c70bfb (diff) | |
download | rsyslog-e6913c77fc1da39e3bf37225d21d8ce4b2429e24.tar.gz rsyslog-e6913c77fc1da39e3bf37225d21d8ce4b2429e24.tar.bz2 rsyslog-e6913c77fc1da39e3bf37225d21d8ce4b2429e24.zip |
added comments
Diffstat (limited to 'syslogd.c')
-rw-r--r-- | syslogd.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -3060,7 +3060,7 @@ static int parseLegacySyslogMsg(msg_t *pMsg, int flags) bTAGCharDetected = 0; if(pMsg->bParseHOSTNAME) { /* TODO: quick and dirty memory allocation */ - if((pBuf = malloc(sizeof(char)* strlen(p2parse) +1)) == NULL) + if((pBuf = malloc(sizeof(char)* (strlen(p2parse) +1))) == NULL) return 1; pWork = pBuf; /* this is the actual parsing loop */ @@ -3071,6 +3071,13 @@ static int parseLegacySyslogMsg(msg_t *pMsg, int flags) } /* we need to handle ':' seperately, because it terminates the * TAG - so we also need to terminate the parser here! + * rgerhards, 2007-09-10 *p2parse points to a valid address here in + * any case. We can reach this point only if we are at end of string, + * or we have a ':' or ' '. What the if below does is check if we are + * not at end of string and, if so, advance the parse pointer. If we + * are already at end of string, *p2parse is equal to '\0', neither if + * will be true and the parse pointer remain as is. This is perfectly + * well. */ if(*p2parse == ':') { bTAGCharDetected = 1; |