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

Andrew Hardie andrewhardie at users.sf.net
Mon Jun 16 01:39:33 CEST 2014


- **Group**: TODO-3.5 --> TODO-4.0



---

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

**Status:** open
**Group:** TODO-4.0
**Labels:** CL low-level library 
**Created:** Fri Sep 03, 2010 11:00 AM UTC by Andrew Hardie
**Last Updated:** Sun Jul 31, 2011 10:55 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://devel.sslmit.unibo.it/pipermail/cwb/attachments/20140615/a69a2c6c/attachment-0001.html>


More information about the CWB mailing list