From 43bf15c34889a5550616bf4c5bfdb119ae663496 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Wed, 14 Oct 1998 17:21:59 +0200
Subject: [PATCH] Fixed compilation error.

Rev: src/builtin_functions.c:1.130
---
 src/builtin_functions.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/builtin_functions.c b/src/builtin_functions.c
index 3bdc252e87..d56556842f 100644
--- a/src/builtin_functions.c
+++ b/src/builtin_functions.c
@@ -4,7 +4,7 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 #include "global.h"
-RCSID("$Id: builtin_functions.c,v 1.129 1998/10/14 05:48:45 hubbe Exp $");
+RCSID("$Id: builtin_functions.c,v 1.130 1998/10/14 15:21:59 grubba Exp $");
 #include "interpret.h"
 #include "svalue.h"
 #include "pike_macros.h"
@@ -230,11 +230,14 @@ void f_search(INT32 args)
 
       start=sp[2-args].u.integer;
       if(start<0)
-	PIKE_ERROR("search", "Start must be greater or equal to zero.\n", sp, args);
+	PIKE_ERROR("search",
+		   "Start must be greater or equal to zero.\n", sp, args);
     }
 
-    if(len<0)
-      PIKE_ERROR("search", "Start must not be greater than the length of the string.\n", sp, args);
+    if(sp[-args].u.string->len < start)
+      PIKE_ERROR("search",
+		 "Start must not be greater than the length of the string.\n",
+		 sp, args);
 
     start=string_search(sp[-args].u.string,
 			sp[1-args].u.string,
-- 
GitLab