OSSP CVS Repository

ossp - Check-in [1958]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 1958
Date: 2002-Mar-07 10:08:11 (local)
2002-Mar-07 09:08:11 (UTC)
User:rse
Branch:
Comment: be even more carefully: regex(3) says rm_so and rm_eo are -1 if a back-reference is not available. So we could match with "&&" here. But because we want to be very carefully we match also rm_eo for -1 and use "||" here. That is, we use a weaker condition to gain stronger safety.
Tickets:
Inspections:
Files:
ossp-pkg/var/var.c      1.83 -> 1.84     1 inserted, 1 deleted

ossp-pkg/var/var.c 1.83 -> 1.84

--- var.c        2002/03/06 11:45:03     1.83
+++ var.c        2002/03/07 09:08:11     1.84
@@ -757,7 +757,7 @@
             }
             i = (*p - '0');
             p++;
-            if (pmatch[i].rm_so == -1) {
+            if (pmatch[i].rm_so == -1 || pmatch[i].rm_eo == -1) {
                 tokenbuf_free(expanded);
                 return VAR_ERR_SUBMATCH_OUT_OF_RANGE;
             }

CVSTrac 2.0.1