diff --git a/grammar/rainerscript.c b/grammar/rainerscript.c index 7afe9b1c9..c91c139fa 100644 --- a/grammar/rainerscript.c +++ b/grammar/rainerscript.c @@ -2,7 +2,7 @@ * * Module begun 2011-07-01 by Rainer Gerhards * - * Copyright 2011-2013 Rainer Gerhards and Adiscon GmbH. + * Copyright 2011-2014 Rainer Gerhards and Adiscon GmbH. * * This file is part of the rsyslog runtime library. * @@ -1362,7 +1362,7 @@ doFunc_re_extract(struct cnffunc *func, struct var *ret, void* usrptr) short matchnbr; regmatch_t pmatch[50]; int bMustFree; - es_str_t *estr; + es_str_t *estr = NULL; /* init just to keep compiler happy */ char *str; struct var r[CNFFUNC_MAX_ARGS]; int iLenBuf; diff --git a/plugins/imfile/imfile.c b/plugins/imfile/imfile.c index 9fde0580f..96487baa5 100644 --- a/plugins/imfile/imfile.c +++ b/plugins/imfile/imfile.c @@ -404,8 +404,8 @@ checkInstance(instanceConf_t *inst) } memcpy(dirn, inst->pszFileName, i); /* do not copy slash */ dirn[i] = '\0'; - CHKmalloc(inst->pszFileBaseName = ustrdup(basen)); - CHKmalloc(inst->pszDirName = ustrdup(dirn)); + CHKmalloc(inst->pszFileBaseName = (uchar*) strdup(basen)); + CHKmalloc(inst->pszDirName = (uchar*) strdup(dirn)); if(dirn[0] == '\0') { dirn[0] = '/'; diff --git a/plugins/imjournal/imjournal.c b/plugins/imjournal/imjournal.c index c18a2795e..f1a68aad8 100644 --- a/plugins/imjournal/imjournal.c +++ b/plugins/imjournal/imjournal.c @@ -304,7 +304,7 @@ readjournal() { /* ... but we know better than to trust the specs */ if (equal_sign == NULL) { errmsg.LogError(0, RS_RET_ERR, "SD_JOURNAL_FOREACH_DATA()" - "returned a malformed field (has no '='): '%s'", get); + "returned a malformed field (has no '='): '%s'", (char*)get); continue; /* skip the entry */ } diff --git a/runtime/nsd_gtls.c b/runtime/nsd_gtls.c index 1110c7a48..4ec6f62b2 100644 --- a/runtime/nsd_gtls.c +++ b/runtime/nsd_gtls.c @@ -2,7 +2,7 @@ * * An implementation of the nsd interface for GnuTLS. * - * Copyright (C) 2007-2013 Rainer Gerhards and Adiscon GmbH. + * Copyright (C) 2007-2014 Rainer Gerhards and Adiscon GmbH. * * This file is part of the rsyslog runtime library. * @@ -50,6 +50,7 @@ #include "nsd_ptcp.h" #include "nsdsel_gtls.h" #include "nsd_gtls.h" +#include "unicode-helper.h" /* things to move to some better place/functionality - TODO */ #define CRLFILE "crl.pem" @@ -288,12 +289,12 @@ gtlsGetCertInfo(nsd_gtls_t *pThis, cstr_t **ppStr) expiration_time = gnutls_x509_crt_get_expiration_time(cert); activation_time = gnutls_x509_crt_get_activation_time(cert); - ctime_r(&activation_time, szBuf); - szBuf[strlen(szBuf) - 1] = '\0'; /* strip linefeed */ - CHKiRet(rsCStrAppendStrf(pStr, (uchar*)"Certificate 1 info: " + ctime_r(&activation_time, (char*)szBuf); + szBuf[ustrlen(szBuf) - 1] = '\0'; /* strip linefeed */ + CHKiRet(rsCStrAppendStrf(pStr, "Certificate 1 info: " "certificate valid from %s ", szBuf)); - ctime_r(&expiration_time, szBuf); - szBuf[strlen(szBuf) - 1] = '\0'; /* strip linefeed */ + ctime_r(&expiration_time, (char*)szBuf); + szBuf[ustrlen(szBuf) - 1] = '\0'; /* strip linefeed */ CHKiRet(rsCStrAppendStrf(pStr, "to %s; ", szBuf)); /* Extract some of the public key algorithm's parameters */ @@ -303,20 +304,20 @@ gtlsGetCertInfo(nsd_gtls_t *pThis, cstr_t **ppStr) /* names */ tmp = szBufLen; - if(gnutls_x509_crt_get_dn(cert, szBuf, &tmp) + if(gnutls_x509_crt_get_dn(cert, (char*)szBuf, &tmp) == GNUTLS_E_SHORT_MEMORY_BUFFER) { szBufLen = tmp; szBuf = malloc(tmp); - gnutls_x509_crt_get_dn(cert, szBuf, &tmp); + gnutls_x509_crt_get_dn(cert, (char*)szBuf, &tmp); } CHKiRet(rsCStrAppendStrf(pStr, "DN: %s; ", szBuf)); tmp = szBufLen; - if(gnutls_x509_crt_get_issuer_dn(cert, szBuf, &tmp) + if(gnutls_x509_crt_get_issuer_dn(cert, (char*)szBuf, &tmp) == GNUTLS_E_SHORT_MEMORY_BUFFER) { szBufLen = tmp; szBuf = realloc((szBuf == szBufA) ? NULL : szBuf, tmp); - gnutls_x509_crt_get_issuer_dn(cert, szBuf, &tmp); + gnutls_x509_crt_get_issuer_dn(cert, (char*)szBuf, &tmp); } CHKiRet(rsCStrAppendStrf(pStr, "Issuer DN: %s; ", szBuf)); diff --git a/runtime/stringbuf.c b/runtime/stringbuf.c index 97bfed406..18af7afe7 100644 --- a/runtime/stringbuf.c +++ b/runtime/stringbuf.c @@ -309,7 +309,7 @@ rsRetVal cstrAppendCStr(cstr_t *pThis, cstr_t *pstrAppend) /* append a printf-style formated string */ -rsRetVal rsCStrAppendStrf(cstr_t *pThis, uchar *fmt, ...) +rsRetVal rsCStrAppendStrf(cstr_t *pThis, char *fmt, ...) { DEFiRet; va_list ap; diff --git a/runtime/stringbuf.h b/runtime/stringbuf.h index 2df48ab4f..9de7ce3bd 100644 --- a/runtime/stringbuf.h +++ b/runtime/stringbuf.h @@ -178,7 +178,7 @@ rsRetVal rsCStrAppendStrWithLen(cstr_t *pThis, uchar* psz, size_t iStrLen); * * \param fmt pointer to the format string (see man 3 printf for details). Must not be NULL. */ -rsRetVal rsCStrAppendStrf(cstr_t *pThis, uchar *fmt, ...); +rsRetVal rsCStrAppendStrf(cstr_t *pThis, char *fmt, ...) __attribute__((format(printf,2, 3))); /** * Append an integer to the string. No special formatting is