- Allow source descriptors with no data to be used as arguments to the
elf{32,64}_xlateto[fm]() translation functions. This change makes our libelf compatible with other ELF(3) implementations. [1] - Update manual page to reflect this change. - Style fixes: wrap a long line. Submitted by: jb [1]
This commit is contained in:
parent
eb326f14a2
commit
742fe6de5d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=173924
@ -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
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user