Skip to content

Many of the samples using mbedtls_ssl_conf_psk() dont check for error #5387

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

Closed
mike-scott opened this issue Dec 14, 2017 · 2 comments
Closed
Assignees
Labels
area: Security Security bug The issue is a bug, or the PR is fixing a bug Good first issue Good for a first time contributor to take priority: low Low impact/importance bug

Comments

@mike-scott
Copy link
Contributor

During a review it was noticed that several of the current samples don't check the return value of mbedtls_ssl_conf_psk(). This should be fixed as this function can fail for various reasons.

  • samples/net/coaps_server/src/coaps_server.c:510: ret = mbedtls_ssl_conf_psk(&conf, psk, strlen((char *)psk),
  • samples/net/mbedtls_sslclient/src/mini_client.c:223: mbedtls_ssl_conf_psk(&conf, psk, sizeof(psk),
  • samples/net/echo_client/src/udp.c:96: mbedtls_ssl_conf_psk(&ctx->tls.mbedtls.conf,
  • samples/net/echo_client/src/tcp.c:96: mbedtls_ssl_conf_psk(&ctx->tls.mbedtls.conf,
  • samples/net/coaps_client/src/coaps_client.c:258: ret = mbedtls_ssl_conf_psk(&conf, psk, strlen((char *)psk),
  • samples/net/http_client/src/main.c:117: mbedtls_ssl_conf_psk(&ctx->tls.mbedtls.conf,
  • samples/net/mqtt_publisher/src/main.c:88: mbedtls_ssl_conf_psk(&ctx->tls.mbedtls.conf,`
@nashif nashif added the bug The issue is a bug, or the PR is fixing a bug label Jan 30, 2018
@nashif nashif added the priority: low Low impact/importance bug label Feb 8, 2018
@pfalcon pfalcon added the area: Security Security label Feb 26, 2018
@galak galak added the Good first issue Good for a first time contributor to take label Dec 6, 2018
@galak
Copy link
Collaborator

galak commented Dec 6, 2018

Looks like we've moved forward on this, but still a few cases need to be addressed:

samples/net/echo_client/src/tcp.c: mbedtls_ssl_conf_psk(&ctx->tls.mbedtls.conf,
samples/net/echo_client/src/udp.c: mbedtls_ssl_conf_psk(&ctx->tls.mbedtls.conf,
samples/net/http_client/src/main.c: mbedtls_ssl_conf_psk(&ctx->tls.mbedtls.conf,

@jukkar
Copy link
Member

jukkar commented Feb 21, 2019

samples/net/echo_client/src/tcp.c: mbedtls_ssl_conf_psk(&ctx->tls.mbedtls.conf,
samples/net/echo_client/src/udp.c: mbedtls_ssl_conf_psk(&ctx->tls.mbedtls.conf,
samples/net/http_client/src/main.c: mbedtls_ssl_conf_psk(&ctx->tls.mbedtls.conf,

These samples are already removed so closing this.

@jukkar jukkar closed this as completed Feb 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Security Security bug The issue is a bug, or the PR is fixing a bug Good first issue Good for a first time contributor to take priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

5 participants