From c27a12c3846f162eb3233d8f60d69305fd55deb3 Mon Sep 17 00:00:00 2001
From: Per Cederqvist <ceder@lysator.liu.se>
Date: Mon, 21 Oct 1991 22:29:40 +0000
Subject: [PATCH] create_text() now checks that the text isn't bigger than
 MAX_TEXT.

---
 src/server/ChangeLog |  5 +++++
 src/server/text.c    | 12 ++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/server/ChangeLog b/src/server/ChangeLog
index fdd02044d..82364fff4 100644
--- a/src/server/ChangeLog
+++ b/src/server/ChangeLog
@@ -1,3 +1,8 @@
+Mon Oct 21 23:14:22 1991  Per Cederqvist  (ceder at robin)
+
+	* text.c (create_text): Check that the length of the text is no
+	  greater than TEXT_LEN.
+
 Wed Sep 25 11:44:17 1991  Per Cederqvist  (ceder at lysator)
 
 	* person.c (do_set_passwd, chk_passwd),
diff --git a/src/server/text.c b/src/server/text.c
index 7bdacb7de..22d51683f 100644
--- a/src/server/text.c
+++ b/src/server/text.c
@@ -1,5 +1,5 @@
 /*
- * $Id: text.c,v 0.7 1991/09/23 18:15:43 ceder Exp $
+ * $Id: text.c,v 0.8 1991/10/21 22:29:33 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.7 1991/09/23 18:15:43 ceder Exp $";
+static char *rcsid = "$Id: text.c,v 0.8 1991/10/21 22:29:33 ceder Exp $";
 
 #include <time.h>
 #include <stdlib.h>
@@ -1655,6 +1655,14 @@ create_text(String	  message,
 
     CHK_LOGIN(0);
 
+    /* Check the length of the text. */
+
+    if ( s_strlen (message) >= TEXT_LEN )
+    {
+	kom_errno = KOM_LONG_STR;
+	return 0;
+    }
+
     /* Check all misc-items */
     
     if ( create_text_check_misc(&no_of_misc, misc) != OK
-- 
GitLab