Skip to content

Commit

Permalink
tls-gnutls: Make loop variable unsigned integer
Browse files Browse the repository at this point in the history
Fix the error below (gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0
20160609):

    Compiling tls.c...
    In file included from tls.c:39:0:
    tls-gnutls.c: In function ‘httpCredentialsAreValidForName’:
    tls-gnutls.c:420:56: error: conversion to ‘int’ from ‘unsigned int’ may change the sign of the result [-Werror=sign-conversion]
               if (!gnutls_x509_crl_get_crt_serial(tls_crl, (unsigned)i, rserial, &r
                                                            ^

Fixes: apple#5532
  • Loading branch information
paulmenzel committed Feb 25, 2019
1 parent cc6b108 commit 23a286f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cups/tls-gnutls.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,8 @@ httpCredentialsAreValidForName(

if (result)
{
int i, /* Looping var */
count; /* Number of revoked certificates */
unsigned int i; /* Looping var */
int count; /* Number of revoked certificates */
unsigned char cserial[1024], /* Certificate serial number */
rserial[1024]; /* Revoked serial number */
size_t cserial_size, /* Size of cert serial number */
Expand All @@ -417,7 +417,7 @@ httpCredentialsAreValidForName(
for (i = 0; i < count; i ++)
{
rserial_size = sizeof(rserial);
if (!gnutls_x509_crl_get_crt_serial(tls_crl, (unsigned)i, rserial, &rserial_size, NULL) && cserial_size == rserial_size && !memcmp(cserial, rserial, rserial_size))
if (!gnutls_x509_crl_get_crt_serial(tls_crl, i, rserial, &rserial_size, NULL) && cserial_size == rserial_size && !memcmp(cserial, rserial, rserial_size))
{
result = 0;
break;
Expand Down

0 comments on commit 23a286f

Please sign in to comment.