AmendHub

jcs

/

subtext

/

amendments

/

416

bile: Reject objects with id 0 in bile_write

This usually indicates some error on the caller's part

jcs made amendment 416 11 months ago
--- bile.c Fri Mar 3 21:39:28 2023 +++ bile.c Wed Mar 15 11:48:53 2023 @@ -695,6 +695,11 @@ bile_write(struct bile *bile, const OSType type, const panic("bile_write: zero len passed"); if (data == NULL) panic("bile_write: NULL data pointer passed"); + if (id == 0) { + warn("bile_write: id cannot be 0"); + _bile_error = bile->last_error = BILE_ERR_BOGUS_OBJECT; + return 0; + } _bile_error = bile->last_error = 0;