[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;
|
||||
if (!buf_len)
|
||||
return true;
|
||||
if (buf_len <= s.len) /* What to do with truncation? Returning false for now. */
|
||||
return false;
|
||||
strncpy (buf, s.arrayZ, s.len);
|
||||
buf[s.len] = '\0';
|
||||
unsigned int len = MIN (buf_len - 1, s.len);
|
||||
strncpy (buf, s.arrayZ, len);
|
||||
buf[len] = '\0';
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user