9169 libsldap: comparison between pointer and zero character constant

Review Request #896 — Created Feb. 22, 2018 and submitted

tsoome
illumos-gate
9169
6ba0443...
general
../common/ns_crypt.c:101:19: error: comparison between pointer and zero character constant [-Werror=pointer-compare]
   if (++anHexaStr != '\0') {
                   ^~
../common/ns_crypt.c:101:7: note: did you mean to dereference the pointer?
   if (++anHexaStr != '\0') {
       ^~

../common/ns_writes.c: In function '__s_cvt_hosts':
../common/ns_writes.c:2035:54: error: comparison between pointer and zero character constant [-Werror=pointer-compare]
      ptr->h_addr_list == NULL || ptr->h_addr_list[0] == '\0') {
                                                      ^~
../common/ns_writes.c:2035:34: note: did you mean to dereference the pointer?
      ptr->h_addr_list == NULL || ptr->h_addr_list[0] == '\0') {
                                  ^
../common/ns_writes.c: In function '__s_cvt_services':
../common/ns_writes.c:2347:61: error: comparison between pointer and zero character constant [-Werror=pointer-compare]
  if (ptr->s_name == NULL || ptr->s_port < 0 || ptr->s_proto == '\0') {
                                                             ^~
../common/ns_writes.c:2347:48: note: did you mean to dereference the pointer?
  if (ptr->s_name == NULL || ptr->s_port < 0 || ptr->s_proto == '\0') {
                                                ^
../common/ns_writes.c: In function '__s_cvt_netmasks':
../common/ns_writes.c:2561:19: error: comparison between pointer and zero character constant [-Werror=pointer-compare]
  if (ptr->netmask != '\0') {
                   ^~
../common/ns_writes.c:2561:6: note: did you mean to dereference the pointer?
  if (ptr->netmask != '\0') {
      ^
../common/ns_writes.c: In function '__s_cvt_netgroups':
../common/ns_writes.c:2619:16: error: comparison between pointer and zero character constant [-Werror=pointer-compare]
  if (ptr->name != '\0') {
                ^~
../common/ns_writes.c:2619:6: note: did you mean to dereference the pointer?
  if (ptr->name != '\0') {
      ^
../common/ns_writes.c: In function '__s_cvt_bootparams':
../common/ns_writes.c:2718:16: error: comparison between pointer and zero character constant [-Werror=pointer-compare]
  if (ptr->name != '\0') {
                ^~
../common/ns_writes.c:2718:6: note: did you mean to dereference the pointer?
  if (ptr->name != '\0') {
      ^
../common/ns_writes.c: In function '__s_cvt_ethers':
../common/ns_writes.c:2782:38: error: comparison between pointer and zero character constant [-Werror=pointer-compare]
  if (ptr->name == NULL || ptr->ether == '\0') {
                                      ^~
../common/ns_writes.c:2782:27: note: did you mean to dereference the pointer?
  if (ptr->name == NULL || ptr->ether == '\0') {
                           ^
cc1: all warnings being treated as errors


  • 0
  • 0
  • 0
  • 1
  • 1
Description From Last Updated
yuripv
  1. That's really weird code, but as the logic didn't change thanks to '\0' and NULL being the same, ship it.

  2. 
      
tsoome
tsoome
tsoome
tsoome
gwr
  1. 
      
  2. usr/src/lib/libsldap/common/ns_writes.c (Diff revision 3)
     
     

    Seeing all these needless indentation changes in reviews (wasting my reviewer time) still annoys me...

    There is absolutely nothing wrong with a tab here.

    Grumble!

    1. If there is nothing wrong, then pbchk shouldn't complain.

    2. I tried. That was https://www.illumos.org/issues/8419
      This is an example of the cost of that bug.
      This review is now larger than what I have time for.

    3. And you did agree that it's only you who wants that, so why bring it up again? :-)

    4. BTW, if you select diff 0-2 (i.e. not including last change), you'll get a review without cstyle changes that you don't like.

  3. 
      
citrus
  1. Ship It!
  2. 
      
tsoome
kmays
  1. Ship It!
  2. 
      
tsoome
vgusev
  1. 
      
  2. usr/src/lib/libsldap/common/ns_writes.c (Diff revision 5)
     
     

    I guess here was missing dereference, but you imporoved it and move this check to the line 3016 (after).
    Do you think it was by design to add non empty alias ? I am asking because before-patch it is allowed, but after patch behaviour is changed.

    If you are sure, feel free drop Issue.

    1. The function is to convert aliases, and to do that, they first create rdn at line #3026 (#3023 in update), if the ptr->alias is empty string, we will get rdn "cn=" and that should alarm anyone who has worked with LDAP -- its clearly a problem. It also does mean, we do not have alias to be converted, and we can return with error. I think it actually is "impossible" error, but we should expect unexpected there:)

      Note, the other tables do have similar checks in place, although I'm not sure if all those other cases are handled correctly, but thats another issue anyhow.

  3. 
      
tsoome
Review request changed

Status: Closed (submitted)

Loading...