diff --git a/plugins/in_winevtlog/pack.c b/plugins/in_winevtlog/pack.c index 0a03e83dbf8..d9660c6377b 100644 --- a/plugins/in_winevtlog/pack.c +++ b/plugins/in_winevtlog/pack.c @@ -282,7 +282,9 @@ static int pack_sid(struct winevtlog_config *ctx, PSID sid, int extract_sid) &len, &sid_type)) { err = GetLastError(); if (err == ERROR_NONE_MAPPED) { - strcpy_s(account, MAX_NAME, "NONE_MAPPED"); + flb_plg_debug(ctx->ins, "AccountSid is not mapped. code: %u", err); + + goto not_mapped_error; } else { flb_plg_warn(ctx->ins, "LookupAccountSid Error %u", err); @@ -327,12 +329,17 @@ static int pack_sid(struct winevtlog_config *ctx, PSID sid, int extract_sid) return ret; } - error: + not_mapped_error: ret = pack_wstr(ctx, wide_sid); LocalFree(wide_sid); - return -1; + return ret; + + error: + LocalFree(wide_sid); + + return ret; } return ret;