From 4a30c41610f85ee405c1bbf044f6ff79c8cc98ad Mon Sep 17 00:00:00 2001 From: chrislu Date: Sun, 24 Aug 2025 19:58:19 -0700 Subject: [PATCH] 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 --- weed/command/s3.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/weed/command/s3.go b/weed/command/s3.go index 92969d076..96fb4c58a 100644 --- a/weed/command/s3.go +++ b/weed/command/s3.go @@ -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)