mirror of https://github.com/gophish/gophish
Simple check for empty columns in CSV import to prevent crashes
parent
35a8f13990
commit
240a0d3ad2
|
@ -91,20 +91,20 @@ func ParseCSV(r *http.Request) ([]models.Target, error) {
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if fi != -1 {
|
if fi != -1 && len(record) > fi {
|
||||||
fn = record[fi]
|
fn = record[fi]
|
||||||
}
|
}
|
||||||
if li != -1 {
|
if li != -1 && len(record) > li {
|
||||||
ln = record[li]
|
ln = record[li]
|
||||||
}
|
}
|
||||||
if ei != -1 {
|
if ei != -1 && len(record) > ei {
|
||||||
csvEmail, err := mail.ParseAddress(record[ei])
|
csvEmail, err := mail.ParseAddress(record[ei])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
ea = csvEmail.Address
|
ea = csvEmail.Address
|
||||||
}
|
}
|
||||||
if pi != -1 {
|
if pi != -1 && len(record) > pi {
|
||||||
ps = record[pi]
|
ps = record[pi]
|
||||||
}
|
}
|
||||||
t := models.Target{
|
t := models.Target{
|
||||||
|
|
Loading…
Reference in New Issue