On Thu, Sep 17, 2026 at 10:58:10AM +0200, Jonas Rebmann wrote:
> On 2026-09-17 09:14, Andy Shevchenko wrote:
> > On Wed, Sep 16, 2026 at 07:38:06PM +0200, Jonas Rebmann wrote:
> > > string_unescape() returns the number of character written to dst, not
> > > counting the null terminator which is always written.
> > > 
> > > Ensure string_unescape has included the null terminator by adding a
> > > separate check.

...

> > > - KUNIT_ASSERT_EQ_MSG(test, q_real, q_test, "name:%s", name);
> > > + KUNIT_EXPECT_EQ_MSG(test, q_real, q_test, "name:%s", name);
> > >                                     char *out_test, size_t q_test)
> > 
> > The commit message doesn't explain why it's safe to continue the test if the
> > first assertion fails. Care to elaborate?
> 
> It is safe against out of bounds access because both buffers are
> allocated by the callers, not by the function under test, and the
> comparison is done for the number of bytes expected, not whatever the
> function under test indicates was written.

Yes, but assertion aborts the test, while expect just fail the certain
condition and moves on.

> I would add this explanation to the v2 commit message

Thank you!

-- 
With Best Regards,
Andy Shevchenko



Reply via email to