spetz commented on code in PR #3097:
URL: https://github.com/apache/iggy/pull/3097#discussion_r3078129616


##########
foreign/go/internal/command/user.go:
##########
@@ -116,10 +116,10 @@ func (u *UpdatePermissions) MarshalBinary() ([]byte, 
error) {
        if err != nil {
                return nil, err
        }
-       length := len(userIdBytes)
+       length := len(userIdBytes) + 1
 
        if u.Permissions != nil {
-               length += 1 + 4 + u.Permissions.Size()

Review Comment:
   This is incorrect, as the byte on the front sets the flag whether 
permissions are present or not (1 or 0 as the value).
   
   Actually, it should work like this (this byte is required).
   
   ```go
   length := len(userIdBytes) + 1  // +1 for has_permissions flag
   if u.Permissions != nil {
       length += 4 + u.Permissions.Size()
   }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to