@@ -1212,13 +1212,18 @@ func getSeUserFromReader(username string, gids []string, r io.Reader, lookupGrou
12121212 var groupSeUser , groupLevel string
12131213
12141214 lineNum := - 1
1215- scanner := bufio .NewScanner (r )
1216- for scanner .Scan () {
1217- line := scanner .Text ()
1215+ reader := bufio .NewReader (r )
1216+ for {
1217+ lineBytes , readErr := reader .ReadBytes ('\n' )
1218+ if readErr != nil {
1219+ if ! errors .Is (readErr , io .EOF ) {
1220+ return "" , "" , fmt .Errorf ("failed to read seusers file: %w" , readErr )
1221+ }
1222+ }
12181223 lineNum ++
12191224
12201225 // remove any trailing comments, then extra whitespace
1221- line , _ , _ = strings .Cut (line , "#" )
1226+ line , _ , _ : = strings .Cut (string ( lineBytes ) , "#" )
12221227 line = strings .TrimSpace (line )
12231228 if line == "" {
12241229 continue
@@ -1258,9 +1263,10 @@ func getSeUserFromReader(username string, gids []string, r io.Reader, lookupGrou
12581263 defaultSeUser = seUserField
12591264 defaultLevel = levelField
12601265 }
1261- }
1262- if err := scanner .Err (); err != nil {
1263- return "" , "" , fmt .Errorf ("failed to read seusers file: %w" , err )
1266+
1267+ if errors .Is (readErr , io .EOF ) {
1268+ break
1269+ }
12641270 }
12651271
12661272 if groupSeUser != "" {
0 commit comments