serve docker: fix incorrect conversion between integer types

This commit is contained in:
albertony 2024-08-15 20:29:24 +02:00
parent 7261f47bd2
commit 4c488e7517

View File

@ -2,6 +2,7 @@ package docker
import (
"fmt"
"math"
"strings"
"github.com/rclone/rclone/cmd/mountlib"
@ -272,10 +273,22 @@ func getVFSOption(vfsOpt *vfscommon.Options, opt rc.Params, key string) (ok bool
err = getFVarP(&vfsOpt.Umask, opt, key)
case "uid":
intVal, err = opt.GetInt64(key)
vfsOpt.UID = uint32(intVal)
if err == nil {
if intVal >= 0 && intVal <= math.MaxUint32 {
vfsOpt.UID = uint32(intVal)
} else {
err = fmt.Errorf("key %q (%v) overflows uint32", key, intVal)
}
}
case "gid":
intVal, err = opt.GetInt64(key)
vfsOpt.GID = uint32(intVal)
if err == nil {
if intVal >= 0 && intVal <= math.MaxUint32 {
vfsOpt.UID = uint32(intVal)
} else {
err = fmt.Errorf("key %q (%v) overflows uint32", key, intVal)
}
}
// non-vfs options
default: