diff options
author | Timo Sirainen <cras@irssi.org> | 2001-11-24 01:31:49 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-11-24 01:31:49 +0000 |
commit | ea904f8dc94f2efc7aa0bf532400502a13dcb2c1 (patch) | |
tree | ee19efaa3a81196e39977f467b31ea6107e450a2 | |
parent | 24015a360ab4e442a59637433c10238c49984e12 (diff) | |
download | irssi-ea904f8dc94f2efc7aa0bf532400502a13dcb2c1.zip |
Irssi::printformat() crashed if the registered format contained $0- etc.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2137 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r-- | src/perl/ui/Themes.xs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/perl/ui/Themes.xs b/src/perl/ui/Themes.xs index cae50865..99f1fc78 100644 --- a/src/perl/ui/Themes.xs +++ b/src/perl/ui/Themes.xs @@ -122,13 +122,13 @@ printformat(level, format, ...) PREINIT: STRLEN n_a; TEXT_DEST_REC dest; - char *arglist[MAX_FORMAT_PARAMS]; + char *arglist[MAX_FORMAT_PARAMS+1]; int n; CODE: format_create_dest(&dest, NULL, NULL, level, NULL); memset(arglist, 0, sizeof(arglist)); - for (n = 2; n < 2+MAX_FORMAT_PARAMS; n++) { - arglist[n-2] = n < items ? SvPV(ST(n), n_a) : ""; + for (n = 2; n < items && n < MAX_FORMAT_PARAMS-2; n++) { + arglist[n-2] = SvPV(ST(n), n_a); } printformat_perl(&dest, format, arglist); @@ -146,13 +146,13 @@ printformat(server, target, level, format, ...) PREINIT: STRLEN n_a; TEXT_DEST_REC dest; - char *arglist[MAX_FORMAT_PARAMS]; + char *arglist[MAX_FORMAT_PARAMS+1]; int n; CODE: format_create_dest(&dest, server, target, level, NULL); memset(arglist, 0, sizeof(arglist)); - for (n = 4; n < 4+MAX_FORMAT_PARAMS; n++) { - arglist[n-4] = n < items ? SvPV(ST(n), n_a) : ""; + for (n = 4; n < items && n < MAX_FORMAT_PARAMS-4; n++) { + arglist[n-4] = SvPV(ST(n), n_a); } printformat_perl(&dest, format, arglist); @@ -169,13 +169,13 @@ printformat(window, level, format, ...) PREINIT: STRLEN n_a; TEXT_DEST_REC dest; - char *arglist[MAX_FORMAT_PARAMS]; + char *arglist[MAX_FORMAT_PARAMS+1]; int n; CODE: format_create_dest(&dest, NULL, NULL, level, window); memset(arglist, 0, sizeof(arglist)); - for (n = 3; n < 3+MAX_FORMAT_PARAMS; n++) { - arglist[n-3] = n < items ? SvPV(ST(n), n_a) : ""; + for (n = 3; n < items && n < MAX_FORMAT_PARAMS-3; n++) { + arglist[n-3] = SvPV(ST(n), n_a); } printformat_perl(&dest, format, arglist); @@ -192,13 +192,13 @@ printformat(item, level, format, ...) PREINIT: STRLEN n_a; TEXT_DEST_REC dest; - char *arglist[MAX_FORMAT_PARAMS]; + char *arglist[MAX_FORMAT_PARAMS+1]; int n; CODE: format_create_dest(&dest, item->server, item->name, level, NULL); memset(arglist, 0, sizeof(arglist)); - for (n = 3; n < 3+MAX_FORMAT_PARAMS; n++) { - arglist[n-3] = n < items ? SvPV(ST(n), n_a) : ""; + for (n = 3; n < items && n < MAX_FORMAT_PARAMS-3; n++) { + arglist[n-3] = SvPV(ST(n), n_a); } printformat_perl(&dest, format, arglist); |