Skip to content

Rules are truncated after 255 characters #809

Closed

Description

@ViRb3

If I create a new user rule with a bunch of IPs separated by semi-columns, and the total length exceeds 255 characters, they will be truncated. I suppose the problem is here:

simplewall/src/main.cpp

Lines 5001 to 5016 in c2c8fb1

for (UINT i = 0; i < 255; i++)
{
WCHAR addressLocalString[256];
WCHAR addressRemoteString[256];
_r_str_printf (addressLocalString, RTL_NUMBER_OF (addressLocalString), LM_AD2, i + 1);
_r_str_printf (addressRemoteString, RTL_NUMBER_OF (addressRemoteString), RM_AD2, i + 1);
RtlIpv4StringToAddress (addressLocalString, TRUE, &terminator, &ipv4_local);
RtlIpv4StringToAddress (addressRemoteString, TRUE, &terminator, &ipv4_remote);
UINT32 remote_addr = _r_byteswap_ulong (ipv4_remote.S_un.S_addr);
UINT32 local_addr = _r_byteswap_ulong (ipv4_local.S_un.S_addr);
_wfp_logcallback (flags, &ft, (UINT8*)_r_obj_getstring (ntPath), NULL, (SID*)config.pbuiltin_admins_sid, IPPROTO_TCP, FWP_IP_VERSION_V4, remote_addr, NULL, RP_AD, local_addr, NULL, LP_AD, layer_id, filter_id, FWP_DIRECTION_OUTBOUND, FALSE, FALSE);
}

While I could split the rule into multiple rules, this is a pretty unexpected limitation, and it will definitely bite other people as well. Please consider allowing any length of data.

Activity

  1. dbmaxpayne commented on Sep 19, 2021

    @dbmaxpayne

    Came across this as well. Thanks for researching the root cause.
    Would be great if this limit was actually removed or at least a popup / text box came up when you hit the limit.
    I find it weird that you simply can't continue typing in the rule editor window.

    Nevertheless: Great software. Thanks a bunch :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions