summaryrefslogtreecommitdiffstats
path: root/subsurface.desktop
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2012-10-18 00:43:48 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-10-17 15:08:33 -0700
commit88a321c9833de40be77c133b8818b9abdcae3c2e (patch)
tree855ee7df1616b5b794723c27102b5e645715da3e /subsurface.desktop
parent557a83576522b70709ee12a45077f40d321251a5 (diff)
downloadsubsurface-88a321c9833de40be77c133b8818b9abdcae3c2e.tar.gz
Allocate memory for and truncate strings that go into the title bar
info.c:show_dive_info() uses buffers of 80 char, which might not be enough for all unicode strings to fit. The function snprintf() can be used to truncate a string to the maximum buffer length, however this should not be used with unicode strings, since it can split the bytes of a wide char, causing some corruption. Instead of a fixed buffer we now allocate/free memory for the title text and attempt to more safely truncate user entered text by using g_utf8_strlen() and g_utf8_strncpy(). Long unicode filenames still remain a responsibility of the user, but they should be now safe as well. On the other hand the string formed by the function divename() and the variable maxlen should be monitored by developers to accommodate all translations. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'subsurface.desktop')
0 files changed, 0 insertions, 0 deletions