diff options
| author | jvoisin | 2018-01-15 17:22:30 +0100 |
|---|---|---|
| committer | jvoisin | 2018-01-15 17:22:30 +0100 |
| commit | ca16e6264f8d901e97051c2cb4a14e12e1fce211 (patch) | |
| tree | b214fae851262c16063998640a777db6a9f93d5d | |
| parent | e9b99a26f7c9d7e656e08c3c9ef6dc9afafcb327 (diff) | |
Fix an other off-by-one
| -rw-r--r-- | src/sp_utils.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/sp_utils.c b/src/sp_utils.c index 81941f7..6612e6c 100644 --- a/src/sp_utils.c +++ b/src/sp_utils.c | |||
| @@ -284,11 +284,9 @@ bool sp_match_array_key(const zval* zv, const char* to_match, const pcre* rx) { | |||
| 284 | return true; | 284 | return true; |
| 285 | } | 285 | } |
| 286 | } else { | 286 | } else { |
| 287 | char* idx_str = NULL; | 287 | char* idx_str = emalloc(snprintf(NULL, 0, "%lu", idx) + 1); |
| 288 | 288 | ||
| 289 | // Could use a log. | 289 | sprintf(idx_str, "%lu", idx); // This could use a log. |
| 290 | idx_str = emalloc(snprintf(NULL, 0, "%lu", idx)); | ||
| 291 | sprintf(idx_str, "%lu", idx); | ||
| 292 | if (sp_match_value(idx_str, to_match, rx)) { | 290 | if (sp_match_value(idx_str, to_match, rx)) { |
| 293 | efree(idx_str); | 291 | efree(idx_str); |
| 294 | return true; | 292 | return true; |
