Differences From Artifact [a25cf5ad1f]:
- File src/OFStream.m — part of check-in [f1dae95070] at 2009-06-02 19:25:36 on branch trunk — Improve -[readLine] in OFStream. (user: js, size: 4451) [annotate] [blame] [check-ins using]
To Artifact [b556a211fc]:
- File
src/OFStream.m
— part of check-in
[b464ddcda5]
at
2009-06-09 13:21:12
on branch trunk
— Handle reads with a returned size of 0 safely in -[readLine].
Before, it could call memcpy with size of 0 on a pointer that might be
NULL and thus might be undefined behaviour. This way, it's compatible to
the OFSocket change in the commit before. (user: js, size: 4592) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
188 189 190 191 192 193 194 | @try { cache = [self resizeMemory: cache toSize: cache_len + len]; } @catch (OFException *e) { [self freeMemory: tmp]; @throw e; } | > > > > > > | > | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | @try { cache = [self resizeMemory: cache toSize: cache_len + len]; } @catch (OFException *e) { [self freeMemory: tmp]; @throw e; } /* * It's possible that cache_len + len is 0 and thus cache was * set to NULL by resizeMemory:toSize:. */ if (cache != NULL) memcpy(cache + cache_len, tmp, len); cache_len += len; } } - (size_t)writeNBytes: (size_t)size fromBuffer: (const char*)buf { |
︙ | ︙ |