aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/bio/b_print.c
Commit message (Collapse)AuthorAgeFilesLines
* Clean-up *_DEBUG options.Andy Polyakov2016-04-071-7/+0
| | | | | | | | | Since NDEBUG is defined unconditionally on command line for release builds, we can omit *_DEBUG options in favour of effective "all-on" in debug builds exercised though CI. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Emilia Käsper <emilia@openssl.org>
* Fix memory issues in BIO_*printf functionsMatt Caswell2016-02-251-71/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The internal |fmtstr| function used in processing a "%s" format string in the BIO_*printf functions could overflow while calculating the length of a string and cause an OOB read when printing very long strings. Additionally the internal |doapr_outch| function can attempt to write to an OOB memory location (at an offset from the NULL pointer) in the event of a memory allocation failure. In 1.0.2 and below this could be caused where the size of a buffer to be allocated is greater than INT_MAX. E.g. this could be in processing a very long "%s" format string. Memory leaks can also occur. These issues will only occur on certain platforms where sizeof(size_t) > sizeof(int). E.g. many 64 bit systems. The first issue may mask the second issue dependent on compiler behaviour. These problems could enable attacks where large amounts of untrusted data is passed to the BIO_*printf functions. If applications use these functions in this way then they could be vulnerable. OpenSSL itself uses these functions when printing out human-readable dumps of ASN.1 data. Therefore applications that print this data could be vulnerable if the data is from untrusted sources. OpenSSL command line applications could also be vulnerable where they print out ASN.1 data, or if untrusted data is passed as command line arguments. Libssl is not considered directly vulnerable. Additionally certificates etc received via remote connections via libssl are also unlikely to be able to trigger these issues because of message size limits enforced within libssl. CVE-2016-0799 Issue reported by Guido Vranken. Reviewed-by: Andy Polyakov <appro@openssl.org>
* Remove /* foo.c */ commentsRich Salz2016-01-261-1/+0
| | | | | | | | | | | | This was done by the following find . -name '*.[ch]' | /tmp/pl where /tmp/pl is the following three-line script: print unless $. == 1 && m@/\* .*\.[ch] \*/@; close ARGV if eof; # Close file to reset $. And then some hand-editing of other files. Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
* Cleanup CRYPTO_{push,pop}_infoRich Salz2015-12-221-2/+0
| | | | | | | | Rename to OPENSSL_mem_debug_{push,pop}. Remove simple calls; keep only calls used in recursive functions. Ensure we always push, to simplify so that we can always pop Reviewed-by: Richard Levitte <levitte@openssl.org>
* Continue standardising malloc style for libcryptoMatt Caswell2015-11-091-1/+1
| | | | | | | Continuing from previous commit ensure our style is consistent for malloc return checks. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* Harmonize pointer printing and size_t-fy casts.Andy Polyakov2015-10-051-1/+1
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Identify and move common internal libcrypto header filesRichard Levitte2015-05-141-1/+1
| | | | | | | | | | | | | There are header files in crypto/ that are used by a number of crypto/ submodules. Move those to crypto/include/internal and adapt the affected source code and Makefiles. The header files that got moved are: crypto/cryptolib.h crypto/md32_common.h Reviewed-by: Rich Salz <rsalz@openssl.org>
* Clarify logic in BIO_*printf functionsMatt Caswell2015-04-301-24/+21
| | | | | | | | | | | | | | The static function dynamically allocates an output buffer if the output grows larger than the static buffer that is normally used. The original logic implied that |currlen| could be greater than |maxlen| which is incorrect (and if so would cause a buffer overrun). Also the original logic would call OPENSSL_malloc to create a dynamic buffer equal to the size of the static buffer, and then immediately call OPENSSL_realloc to make it bigger, rather than just creating a buffer than was big enough in the first place. Thanks to Kevin Wojtysiak (Int3 Solutions) and Paramjot Oberoi (Int3 Solutions) for reporting this issue. Reviewed-by: Andy Polyakov <appro@openssl.org>
* Code style: space after 'if'Viktor Dukhovni2015-04-161-2/+2
| | | | Reviewed-by: Matt Caswell <matt@openssl.org>
* Remove dead code from cryptoMatt Caswell2015-03-171-5/+2
| | | | | | Some miscellaneous removal of dead code from lib crypto. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Unchecked malloc fixesMatt Caswell2015-03-051-0/+8
| | | | | | | Miscellaneous unchecked malloc fixes. Also fixed some mem leaks on error paths as I spotted them along the way. Reviewed-by: Tim Hudson <tjh@openssl.org>
* Run util/openssl-format-source -v -c .Matt Caswell2015-01-221-196/+170
| | | | Reviewed-by: Tim Hudson <tjh@openssl.org>
* mark all block comments that need format preserving so thatTim Hudson2014-12-301-1/+1
| | | | | | | indent will not alter them when reformatting comments Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
* Make bn2dec work on "SIXTY_FOUR_BIT" platforms.Andy Polyakov2007-09-151-3/+3
| | | | PR: 1456
* Fix compilation when HAVE_LONG_LONG isn't defined.Geoff Thorpe2005-07-261-1/+1
|
* fix compiler warning; pow10 is also in math.hNils Larsch2005-05-051-3/+3
|
* some const fixes and cleanupNils Larsch2005-04-051-1/+1
|
* Protect against gcc's "warning: cast does not match function type".Geoff Thorpe2004-03-251-3/+5
|
* Remove a warning for conversion double->long. This has impacts on Windows.Richard Levitte2004-03-211-2/+2
| | | | PR: 849
* To figure out if we're going outside the buffer, use the size of the buffer,Richard Levitte2003-12-111-3/+3
| | | | | | | not the size of the integer used to index in said buffer. PR: 794 Notified by: Rhett Garber <rhett_garber@hp.com>
* Avoid some shadowed variable names.Geoff Thorpe2003-11-041-3/+3
| | | | Submitted by: Nils Larsch
* Remove an unnecessary cast that causes certain compilers (eg. mine) someGeoff Thorpe2003-10-291-4/+4
| | | | confusion. Also silence a couple of signed/unsigned warnings.
* Fix sign bugs.Richard Levitte2003-05-211-1/+1
| | | | PR: 621
* Make %p and %# work properly, at least with pointers and floats.Richard Levitte2003-04-031-4/+15
|
* Security fixes brought forward from 0.9.7.Ben Laurie2002-11-131-6/+6
|
* Certain flag macros were tested with #if instead if #ifdef...Richard Levitte2002-08-021-1/+1
|
* make b_print.c consistent with the rest of OpenSSL:Bodo Möller2002-05-141-0/+7
| | | | disable assert() except for debug builds
* Make the huge buffer smaller, so the size becomes reasonable for small-stack ↵Richard Levitte2002-05-091-1/+3
| | | | | | environments. Notified by Verdon Walker <VWalker@novell.com>
* Move an assert() to avoid core dumps when a static buffer hasn't been given.Richard Levitte2002-05-091-2/+3
| | | | Notified by Verdon Walker <VWalker@novell.com>
* name confusion with HP library function prototype (?)Ulf Möller2001-12-101-2/+2
|
* Win32 fixes:Dr. Stephen Henson2001-04-291-1/+5
| | | | | | define LLONG properly for VC++. stop compiler complaining about signed/unsigned mismatch in apps/engine.c
* Include bn.h so we get BN_LLONG properly defined. Otherwise, we can forget ↵Richard Levitte2001-03-271-0/+1
| | | | things like %lld
* %f conversion bug fixUlf Möller2001-02-271-1/+1
| | | | Submitted by: Henrik Eriksson <henrik.eriksson@axis.com>
* On some operating systems, MAX is defined. Call ours OSSL_MAX insteadRichard Levitte2000-10-221-3/+3
|
* Change the printing mahine used by BIO_printf() and friends so it canRichard Levitte2000-09-071-160/+89
| | | | | | | | | | handle an externally provided "static" buffer as well a a dynamic buffer. The "static" buffer is filled first, but if overflowed, the dynamic buffer is used instead, being allocated somewhere i the heap. This combines the benefits of putting the output in a preallocated buffer (on the stack, for example) and in a buffer that grows somewhere in the heap.
* Increase print buffer (10K instead of just 2K).Bodo Möller2000-09-051-1/+1
|
* ConsistencyBodo Möller2000-09-041-1/+1
|
* Added BIO_vprintf() and BIO_vsnprintf(). The former because I'veRichard Levitte2000-08-181-5/+24
| | | | found myself needing it a number of times, the latter for completeness.
* There have been a number of complaints from a number of sources that namesRichard Levitte2000-06-011-3/+3
| | | | | | | | | like Malloc, Realloc and especially Free conflict with already existing names on some operating systems or other packages. That is reason enough to change the names of the OpenSSL memory allocation macros to something that has a better chance of being unique, like prepending them with OPENSSL_. This change includes all the name changes needed throughout all C files.
* New function ERR_error_string_n.Bodo Möller2000-04-141-51/+73
|
* Let's care about the compiler warnings for both cases, shall we?Richard Levitte2000-03-041-2/+4
|
* gcc warningsUlf Möller2000-03-041-4/+17
|
* Hack b_print.c to implement asprintf() functionality. Not enabled byRichard Levitte2000-03-021-46/+165
| | | | | | | | default yet, I wanna play with it a bit more. For those who don't know: asprintf() is an allocating sprintf. The first argument to it is a double indirection to char instead of a single.
* Bug fix.Ulf Möller2000-02-291-1/+1
| | | | Pointed out by: Gisle Vanem <gvanem@eunet.no>
* Typo corrected.Richard Levitte2000-02-281-1/+1
|
* Short is always promoted to int when passed as a function argument.Richard Levitte2000-02-271-3/+2
| | | | This is especially true when it's part of a '...'.
* Don't include sys/types.h if NO_SYS_TYPES_H is defined.Richard Levitte2000-02-261-1/+3
|
* Let's avoid compiler warnings over types.Richard Levitte2000-02-261-2/+3
| | | | | Actually, this should be resolved by using size_t a bit more, but that'll be for later.
* Gets around VC++ compiler pickiness. (long != double)Geoff Thorpe2000-02-251-1/+1
| | | | PR:
* different snprintf version.Ulf Möller2000-02-251-566/+575
|