Skip to content

Commit

Permalink
Merge pull request #198 from flaviojs/fix-null-dereference-cmd_send_a…
Browse files Browse the repository at this point in the history
…ux_msg

Fix null dereference in cmd_send_aux_msg.
  • Loading branch information
grossmj authored Mar 28, 2024
2 parents 456a3a6 + 0cf9e37 commit be054cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions stable/hv_vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,10 @@ static int cmd_send_aux_msg(hypervisor_conn_t *conn,int argc,char *argv[])
}
else if (strcmp(format,"base64") == 0 && len >= 0) {
data = malloc(len+1);
if (data == NULL) {
hypervisor_send_reply(conn,HSC_ERR_UNSPECIFIED,1,"out of memory");
return(-1);
}
len = base64_decode((unsigned char*)data,(const unsigned char *)argv[1],len);
written = vtty_store_data(vm->vtty_aux,data,len);
free(data);
Expand Down
4 changes: 4 additions & 0 deletions unstable/hv_vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,10 @@ static int cmd_send_aux_msg(hypervisor_conn_t *conn,int argc,char *argv[])
}
else if (strcmp(format,"base64") == 0 && len >= 0) {
data = malloc(len+1);
if (data == NULL) {
hypervisor_send_reply(conn,HSC_ERR_UNSPECIFIED,1,"out of memory");
return(-1);
}
len = base64_decode((unsigned char*)data,(const unsigned char *)argv[1],len);
written = vtty_store_data(vm->vtty_aux,data,len);
free(data);
Expand Down

0 comments on commit be054cf

Please sign in to comment.