1
0
mirror of https://github.com/Yubico/yubico-pam.git synced 2025-01-18 22:52:11 +01:00

no need for a temp pointer when writing output of filter_result_len()

This commit is contained in:
Klas Lindfors 2015-03-04 09:51:55 +01:00
parent 336351188b
commit 26cc397ba5

13
util.c
View File

@ -467,7 +467,6 @@ write_chalresp_state(FILE *f, CR_STATE *state)
size_t filter_result_len(const char *filter, const char *user, char *output) {
const char *part = NULL;
char *ptr = output;
size_t result = 0;
do
{
@ -477,19 +476,19 @@ size_t filter_result_len(const char *filter, const char *user, char *output) {
len = part - filter;
else
len = strlen(filter);
if (output)
if (output != NULL)
{
strncpy(ptr, filter, len);
ptr += len;
strncpy(output, filter, len);
output += len;
}
result += len;
filter += len + 2;
if(part != NULL)
{
if(output)
if(output != NULL)
{
strncpy(ptr, user, strlen(user));
ptr += strlen(user);
strncpy(output, user, strlen(user));
output += strlen(user);
}
result += strlen(user);
}