Skip to content

Commit

Permalink
in_winevtlog: Handle formatting and not mapped error properly
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 committed Jun 27, 2024
1 parent eb96c34 commit 97f89ec
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions plugins/in_winevtlog/pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 97f89ec

Please sign in to comment.