Uploaded image for project: 'vpp'
  1. vpp
  2. VPP-987

Memory overwritten when using unformat %u

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Open
    • Icon: Medium Medium
    • 17.10
    • None
    • None
    • None

      we found some common using issues about the use of CLI unformat, as follow:

       

      u16 out_port = 0;

      u32 vrf_id = 0, protocol;

      else if (unformat (line_input, "%U %u", unformat_ip4_address,

      &out_addr, &out_port))

       

      when inputing u16 or u8 type param(not u32), the  local variable which behind of "out_port" in stack will be overwrited, is that right? is there some Notes about this?

      I think the bellow code maybe  cause that issue.

      unformat->va_unformat->do_percent->unformat_integer-> *(u32 *) v = value;

       

      such as:

      nat64_add_del_static_bib_command_fn

      ....

       

            Aequitas Wang Junqi
            flyingeagle23 hui wang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: