Skip to content
Permalink
Browse files

[User Database] Fix crashes loading database entries with invalid gro…

…ups.

If the groups for a user is "," (a single comma), it will now be treated
as no groups instead of two empty-string groups.
In general, empty-string groups are now entirely ignored.
Users with two of the same-named group are also ignored, now.
  • Loading branch information...
nmbook committed Nov 28, 2017
1 parent 2f9732d commit acfc10acff2886187361fe35462e72681a859e8a
Showing with 12 additions and 1 deletion.
  1. +12 −1 trunk/clsDatabase.cls
@@ -852,6 +852,7 @@ End Function
' Entry format: username access flags createdby createdon modifiedby modifiedon entrytype banmessage
' 0 1 2 3 4 5 6 7 8
Private Function ParseEntry(ByVal sEntryData As String) As clsDBEntryObj
On Error GoTo ERROR_HANDLER
Dim e() As String ' entry elements
Dim i, j As Integer ' counters
Dim aGroups() As String ' group list
@@ -885,7 +886,9 @@ Private Function ParseEntry(ByVal sEntryData As String) As clsDBEntryObj
Case 8
aGroups = Split(e(i), ENTRY_GROUP_SPLIT)
For j = 0 To UBound(aGroups)
.Groups.Add aGroups(j), aGroups(j)
If LenB(aGroups(j)) > 0 Then
.Groups.Add aGroups(j), LCase$(aGroups(j))
End If
Next j
Case 9
.BanMessage = e(i)
@@ -908,6 +911,14 @@ Private Function ParseEntry(ByVal sEntryData As String) As clsDBEntryObj
End If
End With
End If

Exit Function
ERROR_HANDLER:
If Err.Number = 457 Then
' entry with two groups with the same name
Err.Clear
Resume Next
End If
End Function

' Returns a string used to store the specified entry in the database file.

0 comments on commit acfc10a

Please sign in to comment.
You can’t perform that action at this time.