From: Alan T. DeKok Date: Wed, 2 Dec 2009 11:16:57 +0000 (+0100) Subject: Use intermediate buffer for error messages. X-Git-Tag: release_2_1_8~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=58916f7d8927ca1878dec8913435afd83c492e17;p=thirdparty%2Ffreeradius-server.git Use intermediate buffer for error messages. This prevents the messages from getting mangled --- diff --git a/src/lib/dict.c b/src/lib/dict.c index 1f6c72e7ce0..3fbd110e6e6 100644 --- a/src/lib/dict.c +++ b/src/lib/dict.c @@ -997,8 +997,12 @@ static int process_attribute(const char* fn, const int line, * Add it in. */ if (dict_addattr(argv[0], vendor, type, value, flags) < 0) { + char buffer[256]; + + strlcpy(buffer, fr_strerror(), sizeof(buffer)); + fr_strerror_printf("dict_init: %s[%d]: %s", - fn, line, fr_strerror()); + fn, line, buffer); return -1; } @@ -1035,8 +1039,12 @@ static int process_value(const char* fn, const int line, char **argv, } if (dict_addvalue(argv[1], argv[0], value) < 0) { + char buffer[256]; + + strlcpy(buffer, fr_strerror(), sizeof(buffer)); + fr_strerror_printf("dict_init: %s[%d]: %s", - fn, line, fr_strerror()); + fn, line, buffer); return -1; } @@ -1154,8 +1162,12 @@ static int process_vendor(const char* fn, const int line, char **argv, /* Create a new VENDOR entry for the list */ if (dict_addvendor(argv[0], value) < 0) { + char buffer[256]; + + strlcpy(buffer, fr_strerror(), sizeof(buffer)); + fr_strerror_printf("dict_init: %s[%d]: %s", - fn, line, fr_strerror()); + fn, line, buffer); return -1; }