diff options
author | miod <> | 2014-06-18 04:48:37 +0000 |
---|---|---|
committer | miod <> | 2014-06-18 04:48:37 +0000 |
commit | 53197fa2c21b25bbe10c188ecc79010086749353 (patch) | |
tree | 87cef578ac1efe5ecc67f2c2f2ac8b8070796786 /src | |
parent | 074dd6140b628614c71e89d51539c87a67ba9a17 (diff) | |
download | openbsd-53197fa2c21b25bbe10c188ecc79010086749353.tar.gz openbsd-53197fa2c21b25bbe10c188ecc79010086749353.tar.bz2 openbsd-53197fa2c21b25bbe10c188ecc79010086749353.zip |
Use asprintf() instead of a fixed 128-byte size in SSL_CIPHER_description()
when no storage buffer is passed.
ok deraadt@ tedu@
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libssl/src/ssl/ssl_ciph.c | 22 | ||||
-rw-r--r-- | src/lib/libssl/ssl_ciph.c | 22 |
2 files changed, 22 insertions, 22 deletions
diff --git a/src/lib/libssl/src/ssl/ssl_ciph.c b/src/lib/libssl/src/ssl/ssl_ciph.c index d491a0cab6..b8a6eaf514 100644 --- a/src/lib/libssl/src/ssl/ssl_ciph.c +++ b/src/lib/libssl/src/ssl/ssl_ciph.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl_ciph.c,v 1.54 2014/06/18 04:47:32 miod Exp $ */ | 1 | /* $OpenBSD: ssl_ciph.c,v 1.55 2014/06/18 04:48:37 miod Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -1909,16 +1909,16 @@ SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int len) | |||
1909 | break; | 1909 | break; |
1910 | } | 1910 | } |
1911 | 1911 | ||
1912 | if (buf == NULL) { | 1912 | if (buf == NULL) |
1913 | len = 128; | 1913 | l = asprintf(&buf, format, cipher->name, ver, kx, au, enc, |
1914 | buf = malloc(len); | 1914 | mac, exp_str); |
1915 | if (buf == NULL) | 1915 | else { |
1916 | return("malloc Error"); | 1916 | l = snprintf(buf, len, format, cipher->name, ver, kx, au, enc, |
1917 | } else if (len < 128) | 1917 | mac, exp_str); |
1918 | return("Buffer too small"); | 1918 | if (l >= len) |
1919 | 1919 | l = -1; | |
1920 | l = snprintf(buf, len, format, cipher->name, ver, kx, au, enc, mac, exp_str); | 1920 | } |
1921 | if (l >= len || l == -1) | 1921 | if (l == -1) |
1922 | return("Buffer too small"); | 1922 | return("Buffer too small"); |
1923 | else | 1923 | else |
1924 | return (buf); | 1924 | return (buf); |
diff --git a/src/lib/libssl/ssl_ciph.c b/src/lib/libssl/ssl_ciph.c index d491a0cab6..b8a6eaf514 100644 --- a/src/lib/libssl/ssl_ciph.c +++ b/src/lib/libssl/ssl_ciph.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl_ciph.c,v 1.54 2014/06/18 04:47:32 miod Exp $ */ | 1 | /* $OpenBSD: ssl_ciph.c,v 1.55 2014/06/18 04:48:37 miod Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -1909,16 +1909,16 @@ SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int len) | |||
1909 | break; | 1909 | break; |
1910 | } | 1910 | } |
1911 | 1911 | ||
1912 | if (buf == NULL) { | 1912 | if (buf == NULL) |
1913 | len = 128; | 1913 | l = asprintf(&buf, format, cipher->name, ver, kx, au, enc, |
1914 | buf = malloc(len); | 1914 | mac, exp_str); |
1915 | if (buf == NULL) | 1915 | else { |
1916 | return("malloc Error"); | 1916 | l = snprintf(buf, len, format, cipher->name, ver, kx, au, enc, |
1917 | } else if (len < 128) | 1917 | mac, exp_str); |
1918 | return("Buffer too small"); | 1918 | if (l >= len) |
1919 | 1919 | l = -1; | |
1920 | l = snprintf(buf, len, format, cipher->name, ver, kx, au, enc, mac, exp_str); | 1920 | } |
1921 | if (l >= len || l == -1) | 1921 | if (l == -1) |
1922 | return("Buffer too small"); | 1922 | return("Buffer too small"); |
1923 | else | 1923 | else |
1924 | return (buf); | 1924 | return (buf); |