Commit 92c1bd11 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Check the length of all string arguments to all atomic functions.

parent 48dff312
Mon Dec 16 15:32:57 1991 Per Cederqvist (ceder at ruben)
* admin.c (broadcast, send_message): Don't forget to check the
length of the message.
* text.c (create_text, create_anonymous_text): Fixed error in max
length comparison.
* All the changes below fixes one single bug. When a text is
created that has both a secret and a public conference as
recipient the asynchronous messages that were sent out did not
......
/*
* $Id: admin.c,v 0.5 1991/09/15 10:33:25 linus Exp $
* $Id: admin.c,v 0.6 1991/12/16 17:44:22 ceder Exp $
* Copyright (C) 1991 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -28,7 +28,7 @@
* Administrative calls.
*/
static char *rcsid = "$Id: admin.c,v 0.5 1991/09/15 10:33:25 linus Exp $";
static char *rcsid = "$Id: admin.c,v 0.6 1991/12/16 17:44:22 ceder Exp $";
#include <stdlib.h>
#include "lyskomd.h"
......@@ -138,6 +138,12 @@ broadcast (String message)
{
CHK_LOGIN(FAILURE);
if (s_strlen(message) > BROADCAST_LEN)
{
kom_errno = KOM_LONG_STR;
return FAILURE;
}
async_broadcast(ACTPERS, message);
return OK;
}
......@@ -151,6 +157,12 @@ send_message (Pers_no recipient,
{
CHK_LOGIN(FAILURE);
if (s_strlen(message) > BROADCAST_LEN)
{
kom_errno = KOM_LONG_STR;
return FAILURE;
}
return async_send_message(recipient, ACTPERS, message);
}
......
/*
* $Id: text.c,v 0.11 1991/12/16 16:43:51 ceder Exp $
* $Id: text.c,v 0.12 1991/12/16 17:44:19 ceder Exp $
* Copyright (C) 1991 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -28,7 +28,7 @@
* All atomic calls that deals with texts.
*/
static char *rcsid = "$Id: text.c,v 0.11 1991/12/16 16:43:51 ceder Exp $";
static char *rcsid = "$Id: text.c,v 0.12 1991/12/16 17:44:19 ceder Exp $";
#include <time.h>
#include <stdlib.h>
......@@ -1762,7 +1762,7 @@ create_text(String message,
/* Check the length of the text. */
if ( s_strlen (message) >= TEXT_LEN )
if ( s_strlen (message) > TEXT_LEN )
{
kom_errno = KOM_LONG_STR;
return 0;
......@@ -1835,7 +1835,7 @@ create_anonymous_text(String message,
/* Check the length of the text. */
if ( s_strlen (message) >= TEXT_LEN )
if ( s_strlen (message) > TEXT_LEN )
{
kom_errno = KOM_LONG_STR;
return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment