summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfcolin2006-06-06 13:59:49 +0000
committerfcolin2006-06-06 13:59:49 +0000
commit0b7f0c87dd47ec35d788ee1e3a574a8b21d7e331 (patch)
tree0d35f3ffaac760c76bc9bc8e53b59e2a0a32bb0d
parent442107b69be55cd0ab0d7c8554096d9d20c37d08 (diff)
downloadivy-c-0b7f0c87dd47ec35d788ee1e3a574a8b21d7e331.zip
ivy-c-0b7f0c87dd47ec35d788ee1e3a574a8b21d7e331.tar.gz
ivy-c-0b7f0c87dd47ec35d788ee1e3a574a8b21d7e331.tar.bz2
ivy-c-0b7f0c87dd47ec35d788ee1e3a574a8b21d7e331.tar.xz
ajout test de controle des argument de IvySendMsg.
-rw-r--r--src/ivy.c1
-rw-r--r--src/ivybuffer.c4
2 files changed, 3 insertions, 2 deletions
diff --git a/src/ivy.c b/src/ivy.c
index af7cdc9..5f5a93c 100644
--- a/src/ivy.c
+++ b/src/ivy.c
@@ -750,6 +750,7 @@ int IvySendMsg(const char *fmt, ...)
static IvyBuffer buffer = { NULL, 0, 0}; /* Use satic mem to eliminate multiple call to malloc /free */
va_list ap;
+ if( fmt == 0 || strlen(fmt) == 0 ) return 0;
va_start( ap, fmt );
buffer.offset = 0;
make_message( &buffer, fmt, ap );
diff --git a/src/ivybuffer.c b/src/ivybuffer.c
index 05b4ed1..0d85d98 100644
--- a/src/ivybuffer.c
+++ b/src/ivybuffer.c
@@ -40,7 +40,7 @@ int make_message(IvyBuffer* buffer, const char *fmt, va_list ap)
if ( buffer->data == NULL )
{
perror(" Ivy make message MALLOC error: " );
- return -1;
+ return -1;
}
}
while (1) {
@@ -63,7 +63,7 @@ int make_message(IvyBuffer* buffer, const char *fmt, va_list ap)
buffer->size *= 2; /* twice the old size */
if ((buffer->data = realloc (buffer->data, buffer->size)) == NULL)
{
- perror(" Ivy make message MALLOC error: " );
+ perror(" Ivy make message REALLOC error: " );
return -1;
}
}