Commit f22c6f92 authored by Bruce Momjian's avatar Bruce Momjian

the following patch fixes a bug in the oracle compatibility

    functions btrim() ltrim() and rtrim().

    The error was that the character after the set  was  included
    in the tests (ptr2 pointed to the character after the vardata
    part of set if no match found,  so  comparing  *ptr  or  *end
    against *ptr2 MAY match -> strip).


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being
right. # # Let's break this rule - forgive me.
# #======================================== jwieck@debis.com (Jan
Wieck) #
parent c6dd1e63
/*
* Edmund Mergl <E.Mergl@bawue.de>
*
* $Id: oracle_compat.c,v 1.14 1998/06/15 19:29:36 momjian Exp $
* $Id: oracle_compat.c,v 1.15 1998/08/11 18:38:07 momjian Exp $
*
*/
......@@ -297,7 +297,7 @@ btrim(text *string, text *set)
break;
++ptr2;
}
if (*ptr != *ptr2)
if (ptr2 > end2)
break;
ptr++;
ptr2 = VARDATA(set);
......@@ -316,7 +316,7 @@ btrim(text *string, text *set)
break;
++ptr2;
}
if (*end != *ptr2)
if (ptr2 > end2)
break;
--end;
ptr2 = VARDATA(set);
......@@ -374,7 +374,7 @@ ltrim(text *string, text *set)
break;
++ptr2;
}
if (*ptr != *ptr2)
if (ptr2 > end2)
break;
ptr++;
ptr2 = VARDATA(set);
......@@ -434,7 +434,7 @@ rtrim(text *string, text *set)
break;
++ptr2;
}
if (*ptr != *ptr2)
if (ptr2 > end2)
break;
--ptr;
ptr2 = VARDATA(set);
......
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