diff options
| author | xXx-caillou-xXx | 2018-07-13 14:55:23 +0200 |
|---|---|---|
| committer | jvoisin | 2018-07-13 12:55:23 +0000 |
| commit | 7bd365ebc471409f85e6561f7da4f93d7017bfa4 (patch) | |
| tree | 3a5ef9438a025e53de751a6dd9162cc7ee5df960 /src/sp_var_value.c | |
| parent | b1bf270b41f94ce2df668be611e5b646397a7a52 (diff) | |
Fix various possible integer overflows
Diffstat (limited to 'src/sp_var_value.c')
| -rw-r--r-- | src/sp_var_value.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/sp_var_value.c b/src/sp_var_value.c index e91c3d8..9f656b7 100644 --- a/src/sp_var_value.c +++ b/src/sp_var_value.c | |||
| @@ -131,17 +131,19 @@ static zval *get_object_property(zend_execute_data *ed, zval *object, | |||
| 131 | } | 131 | } |
| 132 | } | 132 | } |
| 133 | zvalue = get_entry_hashtable(array, property, strlen(property)); | 133 | zvalue = get_entry_hashtable(array, property, strlen(property)); |
| 134 | // TODO do we want to log overflow? | ||
| 134 | if (!zvalue) { | 135 | if (!zvalue) { |
| 135 | char *protected_property = emalloc(strlen(property) + 4); | 136 | len = strlen(property) + 4; |
| 136 | len = sprintf(protected_property, PROTECTED_PROP_FMT, 0, 0, property); | 137 | char *protected_property = emalloc(len); |
| 137 | zvalue = get_entry_hashtable(array, protected_property, len); | 138 | snprintf(protected_property, len, PROTECTED_PROP_FMT, 0, 0, property); |
| 139 | zvalue = get_entry_hashtable(array, protected_property, len - 1); | ||
| 138 | efree(protected_property); | 140 | efree(protected_property); |
| 139 | } | 141 | } |
| 140 | if (!zvalue) { | 142 | if (!zvalue) { |
| 141 | char *private_property = emalloc(strlen(class_name) + 3 + strlen(property)); | 143 | len = strlen(class_name) + 3 + strlen(property); |
| 142 | len = | 144 | char *private_property = emalloc(len); |
| 143 | sprintf(private_property, PRIVATE_PROP_FMT, 0, class_name, 0, property); | 145 | snprintf(private_property, len, PRIVATE_PROP_FMT, 0, class_name, 0, property); |
| 144 | zvalue = get_entry_hashtable(array, private_property, len); | 146 | zvalue = get_entry_hashtable(array, private_property, len - 1); |
| 145 | efree(private_property); | 147 | efree(private_property); |
| 146 | } | 148 | } |
| 147 | return zvalue; | 149 | return zvalue; |
