return 0;
}
- strcpy(mykey,url+4);
+ strcpy(mykey,url+4); // will fit
mks = (struct mem_keyed_stream *) palacios_alloc(sizeof(struct mem_keyed_stream));
return 0;
}
- strcpy(mykey,key);
+ strcpy(mykey,key); // will fit
m = create_mem_stream();
return;
}
- strcpy(mykey,key);
+ strcpy(mykey,key); // will fit
m = create_mem_stream_internal(size);
return 0;
}
- strcpy(fks->path,url+5);
+ strcpy(fks->path,url+5); // will fit
fks->stype=STREAM_FILE;
de = lookup_create(&nd,1);
- if (IS_ERR(de)) {
+ if (!de || IS_ERR(de)) {
ERROR("cannot allocate dentry\n");
goto fail_out;
}
ERROR("cannot allocate file keyed stream for key %s\n",key);
return 0;
}
+ // this sequence will fit and terminate with a zero
strcpy(path,fks->path);
strcat(path,"/");
strcat(path,key);
- fs = (struct file_stream *) palacios_alloc(sizeof(struct file_stream *));
+ fs = (struct file_stream *) palacios_alloc(sizeof(struct file_stream));
if (!fs) {
ERROR("cannot allocate file keyed stream for key %s\n",key);
fs->f = filp_open(path,O_RDWR|O_CREAT|O_LARGEFILE,0600);
- if (IS_ERR(fs->f)) {
+ if (!fs->f || IS_ERR(fs->f)) {
ERROR("cannot open relevent file \"%s\" for stream \"file:%s\" and key \"%s\"\n",path,fks->path,key);
palacios_free(fs);
palacios_free(path);
s->op->type = PALACIOS_KSTREAM_OPEN_KEY;
s->op->buf_len = len;
- strncpy(s->op->buf,key,len);
+ strncpy(s->op->buf,key,len); // will terminate buffer
// enter with it locked
if (do_request_to_response(s,&flags)) {
ERROR("Could not send tag length in write_key_net\n");
return -1;
}
- if (send_msg(nks->ns,tag,taglen)!=len) {
+ if (send_msg(nks->ns,tag,taglen)!=taglen) {
ERROR("Could not send tag in write_key_net\n");
return -1;
}
static int guest_deinit_keyed_streams(struct v3_guest * guest, void * vm_data)
{
+ remove_guest_ctrl(guest, V3_VM_KSTREAM_USER_CONNECT);
return 0;
}