Added zero-length buffer checks in hash_update() and related