vte r2205 - in trunk: . src
- From: behdad svn gnome org
- To: svn-commits-list gnome org
- Subject: vte r2205 - in trunk: . src
- Date: Wed, 26 Nov 2008 20:57:48 +0000 (UTC)
Author: behdad
Date: Wed Nov 26 20:57:48 2008
New Revision: 2205
URL: http://svn.gnome.org/viewvc/vte?rev=2205&view=rev
Log:
2008-11-26 Behdad Esfahbod <behdad gnome org>
* src/vteseq.c (_vte_sequence_get_handler): Safely handle input of
length 1.
Modified:
trunk/ChangeLog
trunk/src/vteseq.c
Modified: trunk/src/vteseq.c
==============================================================================
--- trunk/src/vteseq.c (original)
+++ trunk/src/vteseq.c Wed Nov 26 20:57:48 2008
@@ -4014,14 +4014,17 @@
VteTerminalSequenceHandler
_vte_sequence_get_handler (const char *code)
{
- /* all codes at least two characters... */
- if (code[2] == '\0') {
+ int len = strlen (code);
+
+ if (G_UNLIKELY (len < 2)) {
+ return NULL;
+ } else if (len == 2) {
const struct vteseq_2_struct *seqhandler;
seqhandler = vteseq_2_lookup (code, 2);
return seqhandler ? seqhandler->handler : NULL;
} else {
const struct vteseq_n_struct *seqhandler;
- seqhandler = vteseq_n_lookup (code, strlen (code));
+ seqhandler = vteseq_n_lookup (code, len);
return seqhandler ? seqhandler->handler : NULL;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]