forked from osmocom/wireshark
Fix bin2hex().
It was repeatedly overwriting the first character in the buffer, rather than appending characters. Change-Id: Ie34d194d69ac3d685416323c93764aa401d78faa Reviewed-on: https://code.wireshark.org/review/18209 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
5d5f58fb78
commit
74174367ff
|
@ -560,7 +560,7 @@ static gchar* bin2hex(const guint8 *bin, enum bin2hex_enum type, guint32 len)
|
|||
if(size % 2) /* odd */
|
||||
{
|
||||
ch = *str & 0x0f;
|
||||
*buff = NIBBLE_2_ASCHEX(ch);
|
||||
*buff++ = NIBBLE_2_ASCHEX(ch);
|
||||
str++;
|
||||
size--;
|
||||
}
|
||||
|
@ -570,9 +570,9 @@ static gchar* bin2hex(const guint8 *bin, enum bin2hex_enum type, guint32 len)
|
|||
while(size-- > 0)
|
||||
{
|
||||
ch = (*str >> 4) & 0x0f;
|
||||
*buff = NIBBLE_2_ASCHEX(ch);
|
||||
*buff++ = NIBBLE_2_ASCHEX(ch);
|
||||
ch = *str & 0x0f;
|
||||
*buff = NIBBLE_2_ASCHEX(ch);
|
||||
*buff++ = NIBBLE_2_ASCHEX(ch);
|
||||
str++;
|
||||
}
|
||||
*buff = '\0';
|
||||
|
|
Loading…
Reference in New Issue