Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Minor tweak to fix handling of extensions without initializers
[palacios.git] / linux_module / main.c
index b4c4637..f69b269 100644 (file)
@@ -122,6 +122,7 @@ static long v3_dev_ioctl(struct file * filp,
            guest->img_size = user_image.size;
 
            DEBUG("Palacios: Allocating kernel memory for guest image (%llu bytes)\n", user_image.size);
+           // overflow possible here, but only if guest image is probably to large for kernel anyway...
            guest->img = palacios_valloc(guest->img_size);
 
            if (!guest->img) {
@@ -134,7 +135,8 @@ static long v3_dev_ioctl(struct file * filp,
                goto out_err2;
            }      
 
-           strncpy(guest->name, user_image.name, 127);
+           strncpy(guest->name, user_image.name, 128);
+           guest->name[127] = 0;
 
            INIT_LIST_HEAD(&(guest->exts));
 
@@ -161,7 +163,7 @@ out_err:
            unsigned long vm_idx = arg;
             struct v3_guest * guest;
 
-            if (vm_idx > MAX_VMS) {
+            if (vm_idx >= MAX_VMS) {
                 ERROR("Invalid VM index: %ld\n", vm_idx);
                 return -1;
             }
@@ -408,7 +410,7 @@ static int read_guests_details(struct seq_file *s, void *v)
     
     
  out:
-    if (mem) { palacios_vfree(mem); }
+    if (mem) { palacios_vfree(mem); } // dead code but kept for clarity
     if (core) { palacios_vfree(core); }
     if (base) { palacios_vfree(base); }