[post] Return true on truncation

Client can check that buffer was completely filled out and reallocate.
pull/1368/head
Behdad Esfahbod 6 years ago
parent 7d91f07edf
commit 9d5027696e
  1. 7
      src/hb-ot-post-table.hh

@ -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…
Cancel
Save