On Sun, Feb 7, 2016 at 4:01 AM, Karthik Nayak <karthik.188@xxxxxxxxx> wrote: > On Sun, Feb 7, 2016 at 12:03 PM, Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote: >> On Sat, Feb 6, 2016 at 10:15 AM, Karthik Nayak <karthik.188@xxxxxxxxx> wrote: >>> I think the code needs to be changed to: >>> >>> - if ((!arg || len == arg - sp) && >>> + if ((arg || len == ep - sp) && >>> + (!arg || len == arg - sp) && >> >> For completeness, for people reading the mailing list archive, a >> couple alternate fixes were presented elsewhere[1], with a personal >> bias toward: >> >> arg = memchr(...); >> if (!arg) >> arg = ep; > > There is a slight issue with this solution though, as you see 'arg' > gets modified > here, hence 'arg' passed to parser functions will never will null. > [...] > Else we could avoid this assignment and re-assignment by letting 'arg' > hold the value it gets from memcmp(...) and use the solution provided > by me or Ramsay (preferably) > > Ramsay's solution being > > arg = memchr(sp, ':', ep - sp); > - if ((!arg || len == arg - sp) && > + if ((( arg && len == arg - sp) || > + (!arg && len == ep - sp )) && > !memcmp(valid_atom[i].name, sp, len)) > break; Yep, Ramsey's fix is preferable. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html