fix: resolve S3 server startup panic due to nil pointer dereference

Fixed nil pointer dereference in s3.go line 246 when accessing iamConfig pointer.
Added proper nil-checking before dereferencing s3opt.iamConfig.

- Check if s3opt.iamConfig is nil before dereferencing
- Use safe variable for passing IAM config path
- Prevents segmentation violation on server startup
- Maintains backward compatibility
This commit is contained in:
chrislu
2025-08-24 19:58:19 -07:00
parent dc6024c0b9
commit 4a30c41610
+4 -2
View File
@@ -243,7 +243,9 @@ func (s3opt *S3Options) startS3Server() bool {
var s3ApiServer_err error
// Create S3 server with optional advanced IAM integration
if *s3opt.iamConfig != "" {
var iamConfigPath string
if s3opt.iamConfig != nil && *s3opt.iamConfig != "" {
iamConfigPath = *s3opt.iamConfig
glog.V(0).Infof("Starting S3 API Server with advanced IAM integration")
} else {
glog.V(0).Infof("Starting S3 API Server with standard IAM")
@@ -262,7 +264,7 @@ func (s3opt *S3Options) startS3Server() bool {
LocalFilerSocket: localFilerSocket,
DataCenter: *s3opt.dataCenter,
FilerGroup: filerGroup,
IamConfig: *s3opt.iamConfig, // Advanced IAM config (optional)
IamConfig: iamConfigPath, // Advanced IAM config (optional)
})
if s3ApiServer_err != nil {
glog.Fatalf("S3 API Server startup error: %v", s3ApiServer_err)