Project

General

Profile

Actions

Bug #1824

closed

Bug #1450: Illumos should be buildable with GCC4

libsmbns needs to mask PUBLIC_BITS while byteswapping

Added by Rich Lowe almost 10 years ago. Updated almost 10 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
lib - userland libraries
Start date:
2011-11-27
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:

Description

the PUBLIC_BITS macro is defined to be the lower 9 bits of its argument. When assigning into a uint8_t while swapping, we need to mask away the 9th bit to appease GCC4.

diff --git a/usr/src/lib/smbsrv/libsmbns/common/smbns_netbios_cache.c b/usr/src/lib/smbsrv/libsmbns/common/smbns_netbios_cache.c
index e5d1bf7..b938851 100644
--- a/usr/src/lib/smbsrv/libsmbns/common/smbns_netbios_cache.c
+++ b/usr/src/lib/smbsrv/libsmbns/common/smbns_netbios_cache.c
@@ -420,8 +420,8 @@ smb_netbios_cache_status(unsigned char *buf, int bufsize, unsigned char *scope)
             (strcasecmp((char *)scope, (char *)name->scope) == 0)) {
             bcopy(name->name, scan, NETBIOS_NAME_SZ);
             scan += NETBIOS_NAME_SZ;
-            *scan++ = PUBLIC_BITS(name->attributes) >> 8;
-            *scan++ = PUBLIC_BITS(name->attributes);
+            *scan++ = (PUBLIC_BITS(name->attributes) >> 8) & 0xff;
+            *scan++ = PUBLIC_BITS(name->attributes) & 0xff;
             (*numnames)++;
         }
Actions

Also available in: Atom PDF