Fix v3 to v4 crash with a variable with longer name than value

This commit is contained in:
Orestis Floros 2017-12-09 19:50:43 +02:00
parent 9d2d602d60
commit ed22785909
2 changed files with 13 additions and 1 deletions

View File

@ -1065,7 +1065,7 @@ bool parse_file(const char *f, bool use_nagbar) {
int version = detect_version(buf); int version = detect_version(buf);
if (version == 3) { if (version == 3) {
/* We need to convert this v3 configuration */ /* We need to convert this v3 configuration */
char *converted = migrate_config(new, stbuf.st_size); char *converted = migrate_config(new, strlen(new));
if (converted != NULL) { if (converted != NULL) {
ELOG("\n"); ELOG("\n");
ELOG("****************************************************************\n"); ELOG("****************************************************************\n");

View File

@ -95,7 +95,19 @@ EOT
is(launch_get_border($config), 'none', 'no border'); is(launch_get_border($config), 'none', 'no border');
#####################################################################
# test that variables with longer name than value don't crash i3 with
# v3 to v4 conversion.
# See: #3076
#####################################################################
$config = <<'EOT';
set $var a
EOT
my $pid = launch_with_config($config);
does_i3_live;
exit_gracefully($pid);
done_testing; done_testing;