The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/3259

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Fixes this long-standing bug:

chb@conventiont|~
> ~/source/go/bin/lxd import
panic: runtime error: index out of range

goroutine 1 [running]:
main.cmdImport(0xc42008e090, 0x1, 0x1, 0x6, 0xffffffffffffffff)
        /home/chb/source/go/src/github.com/lxc/lxd/lxd/main_import.go:8 +0x320
main.run(0xc420120750, 0x0)
        /home/chb/source/go/src/github.com/lxc/lxd/lxd/main.go:217 +0x844
main.main()
        /home/chb/source/go/src/github.com/lxc/lxd/lxd/main.go:53 +0x26

Signed-off-by: Christian Brauner <[email protected]>
From fc4707298bf7847c4b704d795e7d54382c495ca3 Mon Sep 17 00:00:00 2001
From: Christian Brauner <[email protected]>
Date: Mon, 1 May 2017 17:01:12 +0200
Subject: [PATCH] import: error on out missing name

Fixes this long-standing bug:

chb@conventiont|~
> ~/source/go/bin/lxd import
panic: runtime error: index out of range

goroutine 1 [running]:
main.cmdImport(0xc42008e090, 0x1, 0x1, 0x6, 0xffffffffffffffff)
        /home/chb/source/go/src/github.com/lxc/lxd/lxd/main_import.go:8 +0x320
main.run(0xc420120750, 0x0)
        /home/chb/source/go/src/github.com/lxc/lxd/lxd/main.go:217 +0x844
main.main()
        /home/chb/source/go/src/github.com/lxc/lxd/lxd/main.go:53 +0x26

Signed-off-by: Christian Brauner <[email protected]>
---
 lxd/main_import.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lxd/main_import.go b/lxd/main_import.go
index e7b141f..8f03623 100644
--- a/lxd/main_import.go
+++ b/lxd/main_import.go
@@ -1,10 +1,14 @@
 package main
 
 import (
+       "fmt"
        "github.com/lxc/lxd/client"
 )
 
 func cmdImport(args []string) error {
+       if len(args) < 2 {
+               return fmt.Errorf("please specify a container to import")
+       }
        name := args[1]
        req := map[string]interface{}{
                "name":  name,
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to