Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f22c6f9

Browse files
committed
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) #
1 parent c6dd1e6 commit f22c6f9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/backend/utils/adt/oracle_compat.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Edmund Mergl <E.Mergl@bawue.de>
33
*
4-
* $Id: oracle_compat.c,v 1.14 1998/06/15 19:29:36 momjian Exp $
4+
* $Id: oracle_compat.c,v 1.15 1998/08/11 18:38:07 momjian Exp $
55
*
66
*/
77

@@ -297,7 +297,7 @@ btrim(text *string, text *set)
297297
break;
298298
++ptr2;
299299
}
300-
if (*ptr != *ptr2)
300+
if (ptr2 > end2)
301301
break;
302302
ptr++;
303303
ptr2 = VARDATA(set);
@@ -316,7 +316,7 @@ btrim(text *string, text *set)
316316
break;
317317
++ptr2;
318318
}
319-
if (*end != *ptr2)
319+
if (ptr2 > end2)
320320
break;
321321
--end;
322322
ptr2 = VARDATA(set);
@@ -374,7 +374,7 @@ ltrim(text *string, text *set)
374374
break;
375375
++ptr2;
376376
}
377-
if (*ptr != *ptr2)
377+
if (ptr2 > end2)
378378
break;
379379
ptr++;
380380
ptr2 = VARDATA(set);
@@ -434,7 +434,7 @@ rtrim(text *string, text *set)
434434
break;
435435
++ptr2;
436436
}
437-
if (*ptr != *ptr2)
437+
if (ptr2 > end2)
438438
break;
439439
--ptr;
440440
ptr2 = VARDATA(set);

0 commit comments

Comments
 (0)