diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2005-11-16 18:09:38 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2005-11-16 18:09:38 (GMT) |
commit | 7fbe30d5abcaf3218a7cea93137fe1f76566484a (patch) | |
tree | 3f37b922733208588aa27677824a4ab434bdbdf1 /src/H5.c | |
parent | 671187fd2b53c916f444e849a2fd57bac06552f8 (diff) | |
download | hdf5-7fbe30d5abcaf3218a7cea93137fe1f76566484a.zip hdf5-7fbe30d5abcaf3218a7cea93137fe1f76566484a.tar.gz hdf5-7fbe30d5abcaf3218a7cea93137fe1f76566484a.tar.bz2 |
[svn-r11735] Purpose:
Cleanup.
Description:
Removed the home-made version of snprintf and vsnprintf since they
do not actually enforce the size parameter correctly and could corrupt
memory or as a security hole.
This block of code has been turned off since Aug 11, 2005 for all platforms
except Tflops. No one has reported any problem since--sort of empirical
evidence that all platforms except Tflops support both functions.
Tflops has retired in September. So, no need to keep this block of code.
Also, fixed the HDxxx macro to call the corresponding xxx function.
Platforms tested:
Tested in heping, both serial and parallel.
Diffstat (limited to 'src/H5.c')
-rw-r--r-- | src/H5.c | 101 |
1 files changed, 0 insertions, 101 deletions
@@ -733,107 +733,6 @@ H5close(void) } -/* disable the code of HDsnprintf and HDvsnprintf below to see if they - * are still needed by what platforms. AKC 2005/8/11. - * Turn it on for the Tflops (__PUMAGON__) machine. AKC 2005/8/12. - * The SN_SIZ_MIN is an attempt to require the minimum amount of space needed, - * hoping vsnprintf/snprintf do not print larger than it per request. - */ -#ifdef __PUMAGON__ -#define H5_SN_SIZE_MIN 256 -#ifndef H5_HAVE_SNPRINTF -/*------------------------------------------------------------------------- - * Function: HDsnprintf - * - * Purpose: Writes output to the string BUF under control of the format - * FMT that specifies how subsequent arguments are converted for - * output. It is similar to sprintf except that SIZE specifies - * the maximum number of characters to produce. The trailing - * null character is counted towards this limit, so you should - * allocated at least SIZE characters for the string BUF. - * - * Note: This function is for compatibility on systems that don't have - * snprintf(3). It doesn't actually check for overflow like the - * real snprintf() would. - * - * Return: Success: Number of characters stored, not including - * the terminating null. If this value equals - * SIZE then there was not enough space in BUF - * for all the output. - * - * Failure: -1 - * - * Programmer: Robb Matzke - * Tuesday, November 24, 1998 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -/* ARGSUSED */ -int -HDsnprintf(char *buf, size_t UNUSED size, const char *fmt, ...) -{ - int n; - va_list ap; - - if (size < H5_SN_SIZE_MIN) /* Not safe to call vsprintf */ - return -1; - va_start(ap, fmt); - n = HDvsprintf(buf, fmt, ap); - va_end(ap); - if (n >= size){ - /* buffer overflow has occurred. Attempt to report an error. */ - return -1; - } - return n; -} -#endif /* H5_HAVE_SNPRINTF */ - - -#ifndef H5_HAVE_VSNPRINTF -/*------------------------------------------------------------------------- - * Function: HDvsnprintf - * - * Purpose: The same as HDsnprintf() except the variable arguments are - * passed as a va_list. - * - * Note: This function is for compatibility on systems that don't have - * vsnprintf(3). It doesn't actually check for overflow like the - * real vsnprintf() would. - * - * Return: Success: Number of characters stored, not including - * the terminating null. If this value equals - * SIZE then there was not enough space in BUF - * for all the output. - * - * Failure: -1 - * - * Programmer: Robb Matzke - * Monday, April 26, 1999 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -/* ARGSUSED */ -int -HDvsnprintf(char *buf, size_t UNUSED size, const char *fmt, va_list ap) -{ - int n; - if (size < H5_SN_SIZE_MIN) /* Not safe to call vsprintf */ - return -1; - n = HDvsprintf(buf, fmt, ap); - if (n >= size){ - /* buffer overflow has occurred. Attempt to report an error. */ - return -1; - } - return n; -} -#endif /* H5_HAVE_VSNPRINTF */ -#endif /* __PUMAGON__ */ - - /*------------------------------------------------------------------------- * Function: HDfprintf * |