printstr_ex: handle QUOTE_0_TERMINATED bit consistently
When user_style has QUOTE_0_TERMINATED bit set, printstr_ex prints the fetched string as a NUL-terminated. After this change, the string is being fetched as a NUL-terminated, too. * util.c (printstr_ex): Use umovestr instead of umoven if QUOTE_0_TERMINATED bit is set.
This commit is contained in:
11
util.c
11
util.c
@ -827,8 +827,12 @@ printpath(struct tcb *tcp, long addr)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Print string specified by address `addr' and length `len'.
|
* Print string specified by address `addr' and length `len'.
|
||||||
* If `len' < 0, treat the string as a NUL-terminated string.
|
* If `len' == -1, set QUOTE_0_TERMINATED bit in `user_style'.
|
||||||
* If string length exceeds `max_strlen', append `...' to the output.
|
* If `user_style' has QUOTE_0_TERMINATED bit set, treat the string
|
||||||
|
* as a NUL-terminated string.
|
||||||
|
* Pass `user_style' on to `string_quote'.
|
||||||
|
* Append `...' to the output if either the string length exceeds `max_strlen',
|
||||||
|
* or `len' != -1 and the string length exceeds `len'.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
printstr_ex(struct tcb *tcp, long addr, long len, unsigned int user_style)
|
printstr_ex(struct tcb *tcp, long addr, long len, unsigned int user_style)
|
||||||
@ -865,6 +869,9 @@ printstr_ex(struct tcb *tcp, long addr, long len, unsigned int user_style)
|
|||||||
} else {
|
} else {
|
||||||
if (size > (unsigned long) len)
|
if (size > (unsigned long) len)
|
||||||
size = (unsigned long) len;
|
size = (unsigned long) len;
|
||||||
|
if (style & QUOTE_0_TERMINATED)
|
||||||
|
rc = umovestr(tcp, addr, size, str);
|
||||||
|
else
|
||||||
rc = umoven(tcp, addr, size, str);
|
rc = umoven(tcp, addr, size, str);
|
||||||
}
|
}
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
|
Reference in New Issue
Block a user