- if ((buf->buf = malloc(len)) == NULL) {
+ if (len == 0)
+ buf->buf = NULL;
+ else if ((buf->buf = malloc(len)) == NULL) {This code intentionally permitted malloc(0), because with our malloc/free behaviour that will allocate a non-read/writeable object and a later access to it will nicely crash, exposing a bug. Did you find any bugs in applications with the other ERANGE changes?
