[ovs-dev] [PATCH] netdev-dpdk: Avoid undefined behavior processing devargs

Ben Pfaff blp at ovn.org
Mon Jan 13 17:34:45 UTC 2020

On Thu, Jan 09, 2020 at 01:27:06PM -0500, Aaron Conole wrote:
> In "Use of library functions" in the C standard, the following statement
> is written to apply to all library functions:
>   If an argument to a function has an invalid value (such as ... a
>   null pointer ... the behavior is undefined.
> Later, under the "String handling" section, "Comparison functions" no
> exception is listed for strcmp, which means NULL is invalid.  It may
> be possible for the smap_get to return NULL.

It's not just a technicality for strcmp(), this actually causes SIGSEGV
with most libc, including glibc.

Anyway, I'm glad that this got fixed.

More information about the dev mailing list