[post] Return true on truncation
Client can check that buffer was completely filled out and reallocate.
This commit is contained in:
parent
7d91f07edf
commit
9d5027696e
@ -148,10 +148,9 @@ struct post
|
|||||||
return false;
|
return false;
|
||||||
if (!buf_len)
|
if (!buf_len)
|
||||||
return true;
|
return true;
|
||||||
if (buf_len <= s.len) /* What to do with truncation? Returning false for now. */
|
unsigned int len = MIN (buf_len - 1, s.len);
|
||||||
return false;
|
strncpy (buf, s.arrayZ, len);
|
||||||
strncpy (buf, s.arrayZ, s.len);
|
buf[len] = '\0';
|
||||||
buf[s.len] = '\0';
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user