summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rhimport/fetcher.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/rhimport/fetcher.go b/rhimport/fetcher.go
index e398361..324ee5d 100644
--- a/rhimport/fetcher.go
+++ b/rhimport/fetcher.go
@@ -49,6 +49,7 @@ type FetcherCurlCBData struct {
filename string
remotename string
conv FetchConverter
+ written uint64
writeError error
}
@@ -86,11 +87,18 @@ func curlWriteCallback(ptr []byte, userdata interface{}) bool {
data.filename = newFilename
data.conv = conv
}
- if _, err := data.conv.Write(ptr); err != nil {
+ w, err := data.conv.Write(ptr)
+ if err != nil {
rhl.Printf("Unable to write to converter(%s): %s", data.filename, err)
data.writeError = err
return false
}
+ data.written += uint64(w)
+ if data.written > FILESIZE_MAX {
+ data.writeError = fmt.Errorf("file exceeds maximum file size")
+ return false
+ }
+
return true
}