diff options
author | Kresten Krab Thorup <krab@gcc.gnu.org> | 1993-09-20 10:27:23 +0000 |
---|---|---|
committer | Kresten Krab Thorup <krab@gcc.gnu.org> | 1993-09-20 10:27:23 +0000 |
commit | 9cf8d5481b7dc75b18f0375dc2c1f79295214b84 (patch) | |
tree | ea7ff12e4639137f57337613cb7a4d4fbc384741 | |
parent | 5738a80a2e2e360a5481d97e2018f491c9facce1 (diff) | |
download | gcc-9cf8d5481b7dc75b18f0375dc2c1f79295214b84.zip gcc-9cf8d5481b7dc75b18f0375dc2c1f79295214b84.tar.gz gcc-9cf8d5481b7dc75b18f0375dc2c1f79295214b84.tar.bz2 |
(objc_read_string): Allocate n+1 chars instead of just n.
From-SVN: r5371
-rw-r--r-- | gcc/objc/archive.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/objc/archive.c b/gcc/objc/archive.c index 867b749..ad822fa 100644 --- a/gcc/objc/archive.c +++ b/gcc/objc/archive.c @@ -627,10 +627,10 @@ objc_read_string (struct objc_typed_stream* stream, unsigned int nbytes = buf[0]&_B_VALUE; len = __objc_read_nbyte_uint(stream, nbytes, &nbytes); if (len) { - (*string) = (char*)__objc_xmalloc(nbytes); + (*string) = (char*)__objc_xmalloc(nbytes+1); if (key) hash_add (&stream->stream_table, (void*)key, *string); - len = (*stream->read)(stream->physical, *string, buf[0]&_B_VALUE); + len = (*stream->read)(stream->physical, *string, nbytes); (*string)[nbytes] = '\0'; } } |