[dpdk-dev] [dpdk-stable] [PATCH v1] app/regex: fix segfault in getopt_long call

Thomas Monjalon thomas at monjalon.net
Tue Oct 20 00:06:39 CEST 2020


> >> getopt_long() parses command-line arguments. One of its arguments
> >> 'longopts' is a pointer to the first element of an array of struct
> >> option.  The last element of the array has to be filled with zeros
> >> to mark the end of options. For example:
> >>
> >> struct option longopts[] = {
> >> { "help",  0, 0, ARG_HELP},
> >> ....
> >> /* End of options */
> >> { 0, 0, 0, 0 }
> >> };
> >>
> >> This commit adds the last element. Prior to this commit getopt_long()
> >> continued parsing beyond the longopts[] array which occasionally caused
> >> segmentation faults.
> >>
> >> Fixes: de06137cb295 ("app/regex: add RegEx test application")
> >> Cc: stable at dpdk.org
> >>
> >> Signed-off-by: Ophir Munk <ophirmu at nvidia.com>
> > Acked-by: Ori Kam <orika at nvidia.com>
> Acked-by: Lukasz Wojciechowski <l.wojciechow at partner.samsung.com>

Applied, thanks





More information about the dev mailing list