Fix fd leak in vvfat.c and strncmp() issue in vnc.c
cover Fix fd leak in vvfat.c and strncmp() issue in vnc.c
Two unrelated bugs that David Gilbert had kicking around that are easy to fix. Let's take care of them.
Stefan Hajnoczi (2):
vvfat: avoid leaking file descriptor in commit_one_file()
vnc: fix no-lock-key-sync strncmp() length
block/vvfat.c | 3 +++ ui/vnc.c | 2 +- 2 files changed, 4 insertions(+), 1 deletions(-)
Signature · 1 line
1.7.7.3
PATCH 1/2 vvfat: avoid leaking file descriptor in commit_one_file()
--- block/vvfat.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
block/vvfat.c +3 -0
@@ -2218,6 +2218,7 @@ static int commit_one_file(BDRVVVFATState* s, }if (offset >0 ) {if (lseek (fd, offset,SEEK_SET ) != offset) { +close (fd);g_free (cluster);return -3 ; }
@@ -2238,11 +2239,13 @@ static int commit_one_file(BDRVVVFATState* s, (uint8_t*)cluster, (rest_size + 0x1ff) / 0x200);if (ret <0 ) { +close (fd);g_free (cluster);return ret; }if (write (fd, cluster, rest_size) <0 ) { +close (fd);g_free (cluster);return -2 ; }
Signature · 1 line
1.7.7.3
PATCH 2/2 vnc: fix no-lock-key-sync strncmp() length
In reply to Stefan HajnocziThe no-lock-key-sync option is being parsed incorrectly because of an outdated strcmp() length value. Use the correct length so that invalid option names do not match.
--- ui/vnc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
ui/vnc.c +1 -1
@@ -2763,7 +2763,7 @@ int vnc_display_open(DisplayState *ds, const char *display) password =1 ;/* Require password auth */ }else if (strncmp (options,"reverse" ,7 ) ==0 ) { reverse =1 ; - }else if (strncmp (options,"no-lock-key-sync" ,9 ) ==0 ) { + }else if (strncmp (options,"no-lock-key-sync" ,16 ) ==0 ) { lock_key_sync =0 ; #ifdef CONFIG_VNC_SASL }else if (strncmp (options,"sasl" ,4 ) ==0 ) {
Signature · 1 line
1.7.7.3
Stefan Hajnoczi
AppliedQuoted 10 lines · Stefan Hajnoczi
Two unrelated bugs that David Gilbert had kicking around that are easy to fix. Let's take care of them.
Stefan Hajnoczi (2):
vvfat: avoid leaking file descriptor incommit_one_file()
vnc: fix no-lock-key-syncstrncmp()lengthblock/vvfat.c | 3 +++ ui/vnc.c | 2 +- 2 files changed, 4 insertions(+), 1 deletions(-)
Applied to the trivial patches tree.
Stefan