libselinux: do not add rc to pos twice

In regex_format_error(), when error_data->error_offset is zero, rc is
not updated and should not be added to pos again.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
This commit is contained in:
Nicolas Iooss 2019-09-20 07:59:55 +02:00 committed by Stephen Smalley
parent 340da085a5
commit 68b2e4416e
1 changed files with 3 additions and 3 deletions

View File

@ -552,10 +552,10 @@ void regex_format_error(struct regex_error_data const *error_data, char *buffer,
#endif
if (rc < 0)
abort();
}
pos += rc;
if (pos >= buf_size)
goto truncated;
}
#ifdef USE_PCRE2
rc = pcre2_get_error_message(error_data->error_code,