Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: avoid some int/size_t conversion size/sign warnings #12768

Closed
wants to merge 1 commit into from

Conversation

monnerat
Copy link
Contributor

Silent the following warnings:

stub_gssapi.c: In function 'gss_init_sec_context':
stub_gssapi.c:212:18: warning: conversion to 'size_t' {aka 'long unsigned int'} from 'int' may change the sign of the result [-Wsign-conversion]
  212 |   token = malloc(length);
      |                  ^~~~~~
stub_gssapi.c:222:26: warning: conversion to 'size_t' {aka 'long unsigned int'} from 'int' may change the sign of the result [-Wsign-conversion]
  222 |   used = snprintf(token, length, "%s:%s:%d:", creds,
      |                          ^~~~~~
stub_gssapi.c:233:36: warning: conversion to 'size_t' {aka 'long unsigned int'} from 'int' may change the sign of the result [-Wsign-conversion]
  233 |   memset(token + used, 'A', length - used);
      |                             ~~~~~~~^~~~~~
stub_gssapi.c:238:26: warning: conversion to 'size_t' {aka 'long unsigned int'} from 'int' may change the sign of the result [-Wsign-conversion]
  238 |   output_token->length = length;
      |                          ^~~~~~

As a side effect, it also fixes an snprintf() error detection.

@github-actions github-actions bot added the tests label Jan 24, 2024
@bagder bagder closed this in bc6d3bb Jan 24, 2024
@bagder
Copy link
Member

bagder commented Jan 24, 2024

Thanks!

@monnerat monnerat deleted the nowarn branch January 24, 2024 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

2 participants