[CWB] [cwb:bugs] #41 cl_string_canonical: risk of buffer overflow

Andrew Hardie andrewhardie at users.sf.net
Mon Jul 3 03:38:19 CEST 2017


- **status**: open --> closed-fixed
- **Comment**:

Fixed as of v 3.4.12; API changed as noted.



---

** [bugs:#41] cl_string_canonical: risk of buffer overflow**

**Status:** closed-fixed
**Group:** TODO-4.0
**Labels:** CL low-level library 
**Created:** Fri Sep 03, 2010 11:00 AM UTC by Andrew Hardie
**Last Updated:** Sun Jun 15, 2014 11:39 PM UTC
**Owner:** Andrew Hardie


cl\_string\_canonical currently modifies strings in situ. It will be more convenient for it to always return a newly allocated string unless specifically instructed.

char \* 
cl\_string\_canonical\(char \*s, CorpusCharset charset, int flags, size\_t inplace\_bufsize\)

If inplace\_bufsize == 0 \(or negative\), a newly allocated string is returned.

If inplace\_bufsize > 0, s is modified in-place up to a maximum size of inplace\_bufsize-1 characters \(plus NUL terminator\).  If the normalised string doesn't fit into the buffer, the extra characters are dropped silently.  For UTF-8 strings, the result allocated by Glib is copied to s \(dropping characters that don't fit\) and then free'd, as in the current implementation.

This will break backwards compartibiltiy of the CL.


---

Sent from sourceforge.net because cwb at sslmit.unibo.it is subscribed to https://sourceforge.net/p/cwb/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/cwb/admin/bugs/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://liste.sslmit.unibo.it/pipermail/cwb/attachments/20170703/172d50b9/attachment.html>


More information about the CWB mailing list