Skip to content

Commit

Permalink
[User Database] Fix crashes loading database entries with invalid gro…
Browse files Browse the repository at this point in the history
…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 acfc10a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion trunk/clsDatabase.cls
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -852,6 +852,7 @@ End Function
' Entry format: username access flags createdby createdon modifiedby modifiedon entrytype banmessage ' Entry format: username access flags createdby createdon modifiedby modifiedon entrytype banmessage
' 0 1 2 3 4 5 6 7 8 ' 0 1 2 3 4 5 6 7 8
Private Function ParseEntry(ByVal sEntryData As String) As clsDBEntryObj Private Function ParseEntry(ByVal sEntryData As String) As clsDBEntryObj
On Error GoTo ERROR_HANDLER
Dim e() As String ' entry elements Dim e() As String ' entry elements
Dim i, j As Integer ' counters Dim i, j As Integer ' counters
Dim aGroups() As String ' group list Dim aGroups() As String ' group list
Expand Down Expand Up @@ -885,7 +886,9 @@ Private Function ParseEntry(ByVal sEntryData As String) As clsDBEntryObj
Case 8 Case 8
aGroups = Split(e(i), ENTRY_GROUP_SPLIT) aGroups = Split(e(i), ENTRY_GROUP_SPLIT)
For j = 0 To UBound(aGroups) 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 Next j
Case 9 Case 9
.BanMessage = e(i) .BanMessage = e(i)
Expand All @@ -908,6 +911,14 @@ Private Function ParseEntry(ByVal sEntryData As String) As clsDBEntryObj
End If End If
End With End With
End If 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 End Function


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

0 comments on commit acfc10a

Please sign in to comment.