From c7b9733a5e95ca468fa52f1f893a09a112066fe2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Sun, 7 Sep 1997 21:51:58 +0200
Subject: [PATCH] Type check in f_update()

Rev: src/modules/_Crypto/md5.c:1.6
Rev: src/modules/_Crypto/sha.c:1.7
---
 src/modules/_Crypto/md5.c | 8 ++++++--
 src/modules/_Crypto/sha.c | 6 +++++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/modules/_Crypto/md5.c b/src/modules/_Crypto/md5.c
index f28c88bfa9..fc519236e2 100644
--- a/src/modules/_Crypto/md5.c
+++ b/src/modules/_Crypto/md5.c
@@ -1,5 +1,5 @@
 /*
- * $Id: md5.c,v 1.5 1997/08/26 08:19:16 nisse Exp $
+ * $Id: md5.c,v 1.6 1997/09/07 19:51:57 nisse Exp $
  *
  * A pike module for getting access to some common cryptos.
  *
@@ -20,6 +20,7 @@
 #include "interpret.h"
 #include "program.h"
 #include "error.h"
+#include "module_support.h"
 
 #include "md5.h"
 
@@ -56,7 +57,10 @@ static void f_create(INT32 args)
 	  
 static void f_update(INT32 args)
 {
-  md5_update(THIS, (unsigned INT8 *) (sp-args)->u.string->str, (sp-args)->u.string->len);
+  struct pike_string *s;
+  get_all_args("_Crypto.md5->update", args, "%S", &s);
+
+  md5_update(THIS, (unsigned INT8 *) s->str, s->len);
   pop_n_elems(args);
   push_object(this_object());
 }
diff --git a/src/modules/_Crypto/sha.c b/src/modules/_Crypto/sha.c
index 64620382f4..ae92646d70 100644
--- a/src/modules/_Crypto/sha.c
+++ b/src/modules/_Crypto/sha.c
@@ -13,6 +13,7 @@
 #include "interpret.h"
 #include "program.h"
 #include "error.h"
+#include "module_support.h"
 
 #include "sha.h"
 
@@ -49,7 +50,10 @@ static void f_create(INT32 args)
 	  
 static void f_update(INT32 args)
 {
-  sha_update(THIS, (unsigned INT8 *) (sp-args)->u.string->str, (sp-args)->u.string->len);
+  struct pike_string *s;
+  get_all_args("_Crypto.sha->update", args, "%S", &s);
+
+  sha_update(THIS, (unsigned INT8 *) s->str, s->len);
   pop_n_elems(args);
   push_object(this_object());
 }
-- 
GitLab