diff options
author | Rich Megginson <rmeggins@redhat.com> | 2006-04-11 02:14:54 +0000 |
---|---|---|
committer | Rich Megginson <rmeggins@redhat.com> | 2006-04-11 02:14:54 +0000 |
commit | e8c67e58c2faa3e3f5d328a92391a5a6a4569620 (patch) | |
tree | 7e16092b4dfb0106f446bb6a79552004399f7155 /include | |
parent | 9545e36805201ac0e3172b762373c6df741c2721 (diff) | |
download | ds-e8c67e58c2faa3e3f5d328a92391a5a6a4569620.tar.gz ds-e8c67e58c2faa3e3f5d328a92391a5a6a4569620.tar.xz ds-e8c67e58c2faa3e3f5d328a92391a5a6a4569620.zip |
Bug(s) fixed: 186280
Bug Description: ldapserver: Close potential security vulnerabilities in CGI code
Reviewed by: Nathan, Noriko, and Pete (Thanks!)
Fix Description: Clean up usage of sprintf, strcpy, fgets instead of
gets, fixed buffer usage, etc., mostly in the CGI code and other user
facing code (i.e. setup). Also, Steve Grubb told me about a GCC trick
to force it to check printf style varargs functions, to check the format
string against the argument string, for type mismatches, missing
arguments, and too many arguments.
In the CGI form argument parsing code, we needed to be more careful
about checking for bad input - good input is supposed to look like this:
name=value&name=value&.....
&name=value. I don't think the original code
was checking properly for something like name&name=value.
There was another place where we were not checking to see if a buffer
had enough room before appending a string to it.
I had to change a couple of functions to allow passing in the size of
the buffer.
Fixed some issues raised by Noriko and Nathan.
Platforms tested: RHEL4
Flag Day: no
Doc impact: no
QA impact: should be covered by regular nightly and manual testing
New Tests integrated into TET: none
Diffstat (limited to 'include')
-rw-r--r-- | include/base/ereport.h | 7 | ||||
-rw-r--r-- | include/base/util.h | 14 |
2 files changed, 18 insertions, 3 deletions
diff --git a/include/base/ereport.h b/include/base/ereport.h index fe096750..a097a939 100644 --- a/include/base/ereport.h +++ b/include/base/ereport.h @@ -60,7 +60,12 @@ NSPR_BEGIN_EXTERN_C * the current date. */ -NSAPI_PUBLIC int INTereport(int degree, char *fmt, ...); +NSAPI_PUBLIC int INTereport(int degree, char *fmt, ...) +#ifdef __GNUC__ + __attribute__ ((format (printf, 2, 3))); +#else + ; +#endif NSAPI_PUBLIC int INTereport_v(int degree, char *fmt, va_list args); NSPR_END_EXTERN_C diff --git a/include/base/util.h b/include/base/util.h index fa3614ac..3302a1cf 100644 --- a/include/base/util.h +++ b/include/base/util.h @@ -67,12 +67,22 @@ NSAPI_PUBLIC int INTutil_itoa(int i, char *a); NSAPI_PUBLIC int INTutil_vsprintf(char *s, register const char *fmt, va_list args); -NSAPI_PUBLIC int INTutil_sprintf(char *s, const char *fmt, ...); +NSAPI_PUBLIC int INTutil_sprintf(char *s, const char *fmt, ...) +#ifdef __GNUC__ + __attribute__ ((format (printf, 2, 3))); +#else + ; +#endif NSAPI_PUBLIC int INTutil_vsnprintf(char *s, int n, register const char *fmt, va_list args); -NSAPI_PUBLIC int INTutil_snprintf(char *s, int n, const char *fmt, ...); +NSAPI_PUBLIC int INTutil_snprintf(char *s, int n, const char *fmt, ...) +#ifdef __GNUC__ + __attribute__ ((format (printf, 3, 4))); +#else + ; +#endif NSAPI_PUBLIC int INTutil_strftime(char *s, const char *format, const struct tm *t); |