* A key must start with alpha, number, '/' or '_' and end with space character
*/
if (c == NULL) {
- if (ucl_lex_is_comment (p[0], p[1])) {
+ if (chunk->remain >= 2 && ucl_lex_is_comment (p[0], p[1])) {
if (!ucl_skip_comments (parser)) {
return false;
}
return false;
}
}
- else if (ucl_lex_is_comment (p[0], p[1])) {
+ else if (chunk->remain >= 2 && ucl_lex_is_comment (p[0], p[1])) {
/* Check for comment */
if (!ucl_skip_comments (parser)) {
return false;
*var_expand = true;
}
- if (ucl_lex_is_atom_end (*p) || ucl_lex_is_comment (p[0], p[1])) {
+ if (ucl_lex_is_atom_end (*p) || (chunk->remain >= 2 && ucl_lex_is_comment (p[0], p[1]))) {
break;
}
ucl_chunk_skipc (chunk, p);
default:
/* Skip any spaces and comments */
if (ucl_test_character (*p, UCL_CHARACTER_WHITESPACE_UNSAFE) ||
- ucl_lex_is_comment (p[0], p[1])) {
+ (chunk->remain >= 2 && ucl_lex_is_comment (p[0], p[1]))) {
while (p < chunk->end && ucl_test_character (*p, UCL_CHARACTER_WHITESPACE_UNSAFE)) {
ucl_chunk_skipc (chunk, p);
}
/* Skip whitespaces */
ucl_chunk_skipc (chunk, p);
}
- else if (ucl_lex_is_comment (p[0], p[1])) {
+ else if (chunk->remain >= 2 && ucl_lex_is_comment (p[0], p[1])) {
/* Skip comment */
if (!ucl_skip_comments (parser)) {
return false;
/* Now we need to skip all spaces */
while (p < chunk->end) {
if (!ucl_test_character (*p, UCL_CHARACTER_WHITESPACE_UNSAFE)) {
- if (ucl_lex_is_comment (p[0], p[1])) {
+ if (chunk->remain >= 2 && ucl_lex_is_comment (p[0], p[1])) {
/* Skip comment */
if (!ucl_skip_comments (parser)) {
return false;
return false;
}
macro_len = ucl_expand_variable (parser, ¯o_escaped, macro_start, macro_len);
- parser->state = UCL_STATE_AFTER_VALUE;
+ parser->state = UCL_STATE_KEY;
if (macro_escaped == NULL) {
if (!macro->handler (macro_start, macro_len, macro->ud)) {
return false;