Merge pull request #3076 from orestisf1993/v3-to-v4-issue

minor V3 to v4 issues
This commit is contained in:
Ingo Bürk 2017-12-09 19:42:30 +01:00 committed by GitHub
commit 8cbe705674
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View File

@ -743,7 +743,7 @@ static char *migrate_config(char *input, off_t size) {
/* read the scripts output */ /* read the scripts output */
int conv_size = 65535; int conv_size = 65535;
char *converted = smalloc(conv_size); char *converted = scalloc(conv_size, 1);
int read_bytes = 0, ret; int read_bytes = 0, ret;
do { do {
if (read_bytes == conv_size) { if (read_bytes == conv_size) {
@ -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;