mirror of
https://github.com/libtom/libtomcrypt
synced 2026-08-25 20:26:07 -04:00
fix UBSanitizer issue: applying non-zero offset to null pointer
This commit is contained in:
parent
5c8ac18bd1
commit
661fcd6486
1 changed files with 5 additions and 2 deletions
|
|
@ -56,8 +56,11 @@ static LTC_INLINE int s_bufp_fits(struct bufp *buf, unsigned long to_write)
|
|||
{
|
||||
char *d = buf->work;
|
||||
char *e = buf->end;
|
||||
char *w = d + to_write;
|
||||
if (d == NULL || w < d || w > e)
|
||||
char *w;
|
||||
if (d == NULL || e == NULL)
|
||||
return 0;
|
||||
w = d + to_write;
|
||||
if (w < d || w > e)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue