diff options
| author | Arthur de Jong <arthur@arthurdejong.org> | 2014-05-04 14:38:02 +0200 |
|---|---|---|
| committer | Arthur de Jong <arthur@arthurdejong.org> | 2014-05-04 14:57:09 +0200 |
| commit | 2274b41dcb6bbb2557ab0e4358a11f1d54da12d7 (patch) | |
| tree | 553de2872797d8ccf0d1316889e8d7d344f64d34 /nslcd/service.c | |
| parent | 15fc13ce31cd6455d7c64089425da795da5d51d2 (diff) | |
Make buffer size error logging consistent
This adds logging of most cases where a defined buffer is not large
enough to hold provided data on error log level.
Diffstat (limited to 'nslcd/service.c')
| -rw-r--r-- | nslcd/service.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/nslcd/service.c b/nslcd/service.c index 83218db..1e5d615 100644 --- a/nslcd/service.c +++ b/nslcd/service.c @@ -5,7 +5,7 @@ Copyright (C) 1997-2005 Luke Howard Copyright (C) 2006 West Consulting - Copyright (C) 2006, 2007, 2009, 2010, 2011, 2012, 2013 Arthur de Jong + Copyright (C) 2006-2014 Arthur de Jong This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -71,12 +71,18 @@ static int mkfilter_service_byname(const char *name, const char *protocol, char safename[BUFLEN_SAFENAME], safeprotocol[BUFLEN_SAFENAME]; /* escape attributes */ if (myldap_escape(name, safename, sizeof(safename))) + { + log_log(LOG_ERR, "mkfilter_service_byname(): safename buffer too small"); return -1; + } /* build filter */ if (*protocol != '\0') { if (myldap_escape(protocol, safeprotocol, sizeof(safeprotocol))) + { + log_log(LOG_ERR, "mkfilter_service_byname(): safeprotocol buffer too small"); return -1; + } return mysnprintf(buffer, buflen, "(&%s(%s=%s)(%s=%s))", service_filter, attmap_service_cn, safename, attmap_service_ipServiceProtocol, safeprotocol); @@ -93,7 +99,10 @@ static int mkfilter_service_bynumber(int number, const char *protocol, if (*protocol != '\0') { if (myldap_escape(protocol, safeprotocol, sizeof(safeprotocol))) + { + log_log(LOG_ERR, "mkfilter_service_bynumber(): safeprotocol buffer too small"); return -1; + } return mysnprintf(buffer, buflen, "(&%s(%s=%d)(%s=%s))", service_filter, attmap_service_ipServicePort, number, attmap_service_ipServiceProtocol, safeprotocol); |
