pad_str_len = Z_STRLEN_PP(pad_string);
}
- result = (char *)emalloc(pad_length_abs);
+ result = (char *)emalloc(pad_length_abs+1);
/* If positive, we pad on the right and copy the input now. */
if (Z_LVAL_PP(pad_length) > 0) {
memcpy(result + result_len, Z_STRVAL_PP(input), Z_STRLEN_PP(input));
result_len += Z_STRLEN_PP(input);
}
+ result[result_len] = '\0';
RETURN_STRINGL(result, result_len, 0);
}
efree(args);
if (SCAN_ERROR_WRONG_PARAM_COUNT == result) {
- WRONG_PARAM_COUNT
+ WRONG_PARAM_COUNT;
}
}