diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-04-10 09:31:35 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-04-10 09:31:35 +0200 |
commit | a7860f4dab1afcf94698bc2f52413e94eed64b52 (patch) | |
tree | 5d0ec74cf113c9e1df9673ce26d5cb21c724cd23 /plugins/omrelp/omrelp.c | |
parent | 3d87bbfa9c9c6d111861fcfa393c887b0c7ef99e (diff) | |
download | rsyslog-a7860f4dab1afcf94698bc2f52413e94eed64b52.tar.gz rsyslog-a7860f4dab1afcf94698bc2f52413e94eed64b52.tar.xz rsyslog-a7860f4dab1afcf94698bc2f52413e94eed64b52.zip |
removed dependency on MAXHOSTNAMELEN as much as it made sense.
GNU/Hurd does not define it (because it has no limit), and we have taken
care for cases where it is undefined now. However, some very few places
remain where IMHO it currently is not worth fixing the code. If it is
not defined, we have used a generous value of 1K, which is above IETF
RFC's on hostname length at all. The memory consumption is no issue, as
there are only a handful of this buffers allocated *per run* -- that's
also the main reason why we consider it not worth to be fixed any further.
Diffstat (limited to 'plugins/omrelp/omrelp.c')
-rw-r--r-- | plugins/omrelp/omrelp.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/plugins/omrelp/omrelp.c b/plugins/omrelp/omrelp.c index 39d25812..04571682 100644 --- a/plugins/omrelp/omrelp.c +++ b/plugins/omrelp/omrelp.c @@ -53,7 +53,7 @@ DEFobjCurrIf(errmsg) static relpEngine_t *pRelpEngine; /* our relp engine */ typedef struct _instanceData { - char f_hname[MAXHOSTNAMELEN+1]; + char *f_hname; int compressionLevel; /* 0 - no compression, else level for zlib */ char *port; int bInitialConnect; /* is this the initial connection request of our module? (0-no, 1-yes) */ @@ -98,6 +98,9 @@ CODESTARTfreeInstance if(pData->pRelpClt != NULL) relpEngineCltDestruct(pRelpEngine, &pData->pRelpClt); + if(pData->f_hname != NULL) + free(pData->f_hname); + ENDfreeInstance @@ -284,10 +287,11 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1) /* TODO: make this if go away! */ if(*p == ';') { *p = '\0'; /* trick to obtain hostname (later)! */ - strcpy(pData->f_hname, (char*) q); + CHKmalloc(pData->f_hname = strdup((char*) q)); *p = ';'; - } else - strcpy(pData->f_hname, (char*) q); + } else { + CHKmalloc(pData->f_hname = strdup((char*) q)); + } /* process template */ CHKiRet(cflineParseTemplateName(&p, *ppOMSR, 0, OMSR_NO_RQD_TPL_OPTS, (uchar*) "RSYSLOG_ForwardFormat")); |