diff options
| author | Joseph Koshy <jkoshy@FreeBSD.org> | 2007-11-26 03:09:33 +0000 |
|---|---|---|
| committer | Joseph Koshy <jkoshy@FreeBSD.org> | 2007-11-26 03:09:33 +0000 |
| commit | 742fe6de5db9ecc4c3570b290045930a7a02a587 (patch) | |
| tree | 7ee081be0a048c2162a215cd19b739af5c5b2529 | |
| parent | eb326f14a2bd0a312924826be15121dc8b20eccb (diff) | |
Notes
| -rw-r--r-- | lib/libelf/gelf_xlatetof.3 | 6 | ||||
| -rw-r--r-- | lib/libelf/libelf_xlate.c | 11 |
2 files changed, 5 insertions, 12 deletions
diff --git a/lib/libelf/gelf_xlatetof.3 b/lib/libelf/gelf_xlatetof.3 index 436fef3dcf816..b7699305ea858 100644 --- a/lib/libelf/gelf_xlatetof.3 +++ b/lib/libelf/gelf_xlatetof.3 @@ -208,12 +208,6 @@ specified an unsupported type. .It Bq Er ELF_E_DATA The .Ar src -argument had a zero -.Va d_size -field. -.It Bq Er ELF_E_DATA -The -.Ar src argument specified a buffer size that was not an integral multiple of its underlying type. .It Bq Er ELF_E_DATA diff --git a/lib/libelf/libelf_xlate.c b/lib/libelf/libelf_xlate.c index 06ef8d096a88b..362e82db7cc90 100644 --- a/lib/libelf/libelf_xlate.c +++ b/lib/libelf/libelf_xlate.c @@ -68,8 +68,7 @@ _libelf_xlate(Elf_Data *dst, const Elf_Data *src, unsigned int encoding, return (NULL); } - if (src->d_buf == NULL || dst->d_buf == NULL || - src->d_size == 0) { + if (src->d_buf == NULL || dst->d_buf == NULL) { LIBELF_SET_ERROR(DATA, 0); return (NULL); } @@ -79,8 +78,8 @@ _libelf_xlate(Elf_Data *dst, const Elf_Data *src, unsigned int encoding, return (NULL); } - if ((fsz = (elfclass == ELFCLASS32 ? elf32_fsize : elf64_fsize)(src->d_type, - (size_t) 1, src->d_version)) == 0) + if ((fsz = (elfclass == ELFCLASS32 ? elf32_fsize : elf64_fsize) + (src->d_type, (size_t) 1, src->d_version)) == 0) return (NULL); msz = _libelf_msize(src->d_type, elfclass, src->d_version); @@ -133,8 +132,8 @@ _libelf_xlate(Elf_Data *dst, const Elf_Data *src, unsigned int encoding, dst->d_type = src->d_type; dst->d_size = dsz; - if (db == sb && encoding == LIBELF_PRIVATE(byteorder) && - fsz == msz) + if (src->d_size == 0 || + (db == sb && encoding == LIBELF_PRIVATE(byteorder) && fsz == msz)) return (dst); /* nothing more to do */ (_libelf_get_translator(src->d_type, direction, elfclass))(dst->d_buf, |
