Created
October 17, 2009 15:17
-
-
Save bdrewery/212369 to your computer and use it in GitHub Desktop.
patch for pecl-htscanner to fix php_flag parsing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- htscanner.c.orig 2009-08-03 17:37:27.000000000 +0200 | |
+++ htscanner.c 2009-08-03 17:37:55.000000000 +0200 | |
@@ -103,10 +103,17 @@ | |
if (flag) { | |
/* it's a flag */ | |
- if (!strcasecmp(value, "On") || (value[0] == '1' && value[1] == '\0')) { | |
+ | |
+ /* | |
+ * check only for valid boolean values. | |
+ * Boris HUISGEN <[email protected]> | |
+ */ | |
+ if (!strcasecmp(value, "on")) { | |
value = "1"; | |
- } else { | |
+ } else if (!strcasecmp(value, "off")) { | |
value = "0"; | |
+ } else { | |
+ return FAILURE; | |
} | |
value_len = 1; | |
} else { | |
@@ -188,6 +195,10 @@ | |
value_len = strlen(value); | |
if (value_len > 2 && value[value_len - 2] == '\r') { | |
value[value_len - 2] = 0; | |
+ } else if (value[value_len - 1] == '\n') { | |
+ value[value_len - 1] = 0; | |
+ } else if (value[value_len - 1] == '\r') { | |
+ value[value_len - 1] = 0; | |
} else { | |
value[value_len] = 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment