Varargs functions effectively bypass strong type-checking. It can’t be helped.

From: vpp-dev-boun...@lists.fd.io [mailto:vpp-dev-boun...@lists.fd.io] On 
Behalf Of wang.hu...@zte.com.cn
Sent: Tuesday, September 19, 2017 11:34 PM
To: vpp-dev@lists.fd.io
Cc: gu.ji...@zte.com.cn; wang.ju...@zte.com.cn
Subject: [vpp-dev] some issue about using unformat %u


hi all:

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;











王辉 wanghui



IT开发工程师 IT Development Engineer
虚拟化南京四部/无线研究院/无线产品经营部 NIV Nanjing Dept. IV/Wireless Product R&D 
Institute/Wireless Product Operation Division


_______________________________________________
vpp-dev mailing list
vpp-dev@lists.fd.io
https://lists.fd.io/mailman/listinfo/vpp-dev

Reply via email to