• Phil Sutter's avatar
    tc: pedit: Fix parse_cmd() · f440e9d8
    Phil Sutter authored
    This was horribly broken:
    * pack_key8() and pack_key16() ...
      * missed to invert retain value when applying it to the mask,
      * did not sanitize val by ANDing it with retain,
      * and ignored the mask which is necessary for 'invert' command.
    * pack_key16() did not convert mask to network byte order.
    * Changing the retain value for 'invert' or 'retain' operation seems
      just plain wrong.
    * While here, also got rid of unnecessary offset sanitization in
      pack_key32().
    * Simplify code a bit by always assigning the local mask variable to
      tkey->mask before calling any of the pack_key*() variants.
    Signed-off-by: default avatarPhil Sutter <phil@nwl.cc>
    f440e9d8
m_pedit.c 11.5 KB