projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix error code
[oweals/openssl.git]
/
crypto
/
bio
/
bio_cb.c
diff --git
a/crypto/bio/bio_cb.c
b/crypto/bio/bio_cb.c
index 32ae7be4999f0e874ffa969fdb1e051abee630ed..9bcbc321d94f3947dbfe12fdcf3df99d06ed4b05 100644
(file)
--- a/
crypto/bio/bio_cb.c
+++ b/
crypto/bio/bio_cb.c
@@
-60,77
+60,82
@@
#include <string.h>
#include <stdlib.h>
#include "cryptlib.h"
#include <string.h>
#include <stdlib.h>
#include "cryptlib.h"
-#include
"bio.h"
-#include
"err.h"
+#include
<openssl/bio.h>
+#include
<openssl/err.h>
-long MS_CALLBACK BIO_debug_callback(bio,cmd,argp,argi,argl,ret)
-BIO *bio;
-int cmd;
-const char *argp;
-int argi;
-long argl;
-long ret;
+long MS_CALLBACK BIO_debug_callback(BIO *bio, int cmd, const char *argp,
+ int argi, long argl, long ret)
{
BIO *b;
MS_STATIC char buf[256];
char *p;
long r=1;
{
BIO *b;
MS_STATIC char buf[256];
char *p;
long r=1;
+ size_t p_maxlen;
if (BIO_CB_RETURN & cmd)
r=ret;
if (BIO_CB_RETURN & cmd)
r=ret;
-
sprintf(
buf,"BIO[%08lX]:",(unsigned long)bio);
+
BIO_snprintf(buf,sizeof
buf,"BIO[%08lX]:",(unsigned long)bio);
p= &(buf[14]);
p= &(buf[14]);
+ p_maxlen = sizeof buf - 14;
switch (cmd)
{
case BIO_CB_FREE:
switch (cmd)
{
case BIO_CB_FREE:
-
sprintf(p
,"Free - %s\n",bio->method->name);
+
BIO_snprintf(p,p_maxlen
,"Free - %s\n",bio->method->name);
break;
case BIO_CB_READ:
if (bio->method->type & BIO_TYPE_DESCRIPTOR)
break;
case BIO_CB_READ:
if (bio->method->type & BIO_TYPE_DESCRIPTOR)
- sprintf(p,"read(%d,%d) - %s fd=%d\n",bio->num,argi,bio->method->name,bio->num);
+ BIO_snprintf(p,p_maxlen,"read(%d,%lu) - %s fd=%d\n",
+ bio->num,(unsigned long)argi,
+ bio->method->name,bio->num);
else
else
- sprintf(p,"read(%d,%d) - %s\n",bio->num,argi,bio->method->name);
+ BIO_snprintf(p,p_maxlen,"read(%d,%lu) - %s\n",
+ bio->num,(unsigned long)argi,
+ bio->method->name);
break;
case BIO_CB_WRITE:
if (bio->method->type & BIO_TYPE_DESCRIPTOR)
break;
case BIO_CB_WRITE:
if (bio->method->type & BIO_TYPE_DESCRIPTOR)
- sprintf(p,"write(%d,%d) - %s fd=%d\n",bio->num,argi,bio->method->name,bio->num);
+ BIO_snprintf(p,p_maxlen,"write(%d,%lu) - %s fd=%d\n",
+ bio->num,(unsigned long)argi,
+ bio->method->name,bio->num);
else
else
- sprintf(p,"write(%d,%d) - %s\n",bio->num,argi,bio->method->name);
+ BIO_snprintf(p,p_maxlen,"write(%d,%lu) - %s\n",
+ bio->num,(unsigned long)argi,
+ bio->method->name);
break;
case BIO_CB_PUTS:
break;
case BIO_CB_PUTS:
-
sprintf(p
,"puts() - %s\n",bio->method->name);
+
BIO_snprintf(p,p_maxlen
,"puts() - %s\n",bio->method->name);
break;
case BIO_CB_GETS:
break;
case BIO_CB_GETS:
-
sprintf(p,"gets(%d) - %s\n",
argi,bio->method->name);
+
BIO_snprintf(p,p_maxlen,"gets(%lu) - %s\n",(unsigned long)
argi,bio->method->name);
break;
case BIO_CB_CTRL:
break;
case BIO_CB_CTRL:
-
sprintf(p,"ctrl(%d) - %s\n",
argi,bio->method->name);
+
BIO_snprintf(p,p_maxlen,"ctrl(%lu) - %s\n",(unsigned long)
argi,bio->method->name);
break;
case BIO_CB_RETURN|BIO_CB_READ:
break;
case BIO_CB_RETURN|BIO_CB_READ:
-
sprintf(p
,"read return %ld\n",ret);
+
BIO_snprintf(p,p_maxlen
,"read return %ld\n",ret);
break;
case BIO_CB_RETURN|BIO_CB_WRITE:
break;
case BIO_CB_RETURN|BIO_CB_WRITE:
-
sprintf(p
,"write return %ld\n",ret);
+
BIO_snprintf(p,p_maxlen
,"write return %ld\n",ret);
break;
case BIO_CB_RETURN|BIO_CB_GETS:
break;
case BIO_CB_RETURN|BIO_CB_GETS:
-
sprintf(p
,"gets return %ld\n",ret);
+
BIO_snprintf(p,p_maxlen
,"gets return %ld\n",ret);
break;
case BIO_CB_RETURN|BIO_CB_PUTS:
break;
case BIO_CB_RETURN|BIO_CB_PUTS:
-
sprintf(p
,"puts return %ld\n",ret);
+
BIO_snprintf(p,p_maxlen
,"puts return %ld\n",ret);
break;
case BIO_CB_RETURN|BIO_CB_CTRL:
break;
case BIO_CB_RETURN|BIO_CB_CTRL:
-
sprintf(p
,"ctrl return %ld\n",ret);
+
BIO_snprintf(p,p_maxlen
,"ctrl return %ld\n",ret);
break;
default:
break;
default:
-
sprintf(p
,"bio callback - unknown type (%d)\n",cmd);
+
BIO_snprintf(p,p_maxlen
,"bio callback - unknown type (%d)\n",cmd);
break;
}
b=(BIO *)bio->cb_arg;
if (b != NULL)
BIO_write(b,buf,strlen(buf));
break;
}
b=(BIO *)bio->cb_arg;
if (b != NULL)
BIO_write(b,buf,strlen(buf));
-#if !defined(
NO_STDIO) && !defined(
WIN16)
+#if !defined(
OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_
WIN16)
else
fputs(buf,stderr);
#endif
else
fputs(buf,stderr);
#endif