Commit 7dc7e8f1 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(s_strtol): When a string containing only whitespace was passed to

	s_strtol, s_strtol would attempt to read the sign ('+' or '-')
	past the end of the string.
parent 11708e6b
/*
* $Id: s-string.c,v 1.26 2002/03/29 22:38:07 ceder Exp $
* $Id: s-string.c,v 1.27 2002/08/02 19:09:47 ceder Exp $
* Copyright (C) 1990-1996, 1998-1999, 2001-2002 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -897,6 +897,12 @@ s_strtol (const String str,
while ( (char_no < s_strlen(str)) && isspace(str.string[char_no]) )
char_no++;
if (char_no == s_strlen(str))
{
*first_ill_char = -1;
return 0;
}
/* Find any sign character (+ or -) */
if (str.string[char_no] == '+')
{
......@@ -916,7 +922,7 @@ s_strtol (const String str,
char_no++;
}
*first_ill_char = char_no++;
*first_ill_char = char_no;
if (sign != -1)
return number;
else
......
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