Skip to content
This repository was archived by the owner on Dec 1, 2018. It is now read-only.

Fix <ctype.h> arguments#58

Open
Sebbyastian wants to merge 274 commits intokristapsdz:masterfrom
Sebbyastian:patch-3
Open

Fix <ctype.h> arguments#58
Sebbyastian wants to merge 274 commits intokristapsdz:masterfrom
Sebbyastian:patch-3

Conversation

@Sebbyastian
Copy link

@Sebbyastian Sebbyastian commented Sep 9, 2018

You need to ensure the arguments passed to <ctype.h> functions are unsigned char values or EOF. Casting to int makes no difference here; that conversion would've been implicitly performed anyway due to the type of the argument... what you need to do is cast to unsigned char.

If you need to understand why this is the case, consider that the argument for character type functions might be used as an index for an array... and negative values would cause negative indexes, leading to a situation where attackers might be able to bleed sensitive parts of program context.

kristaps added 30 commits May 15, 2016 11:48
… that

netproc failing doesn't cause short reads and exits.
…g but

looks up addresses as used by netproc.
kristaps and others added 28 commits November 24, 2016 14:01
kristapsdz/acme-client-portable#12 that pushes
the check for file pre-existence with -n and -N only into the main
process, stripping out the arguments before passing them to the child.
This fixes a race condition.
allows certain variables to be overriden.  This allows us to provide -nN
and have them properly be nullified by the child processes.
…back-

port that to the older API of libressl.
…ortable#13 .

This creates a triplet exported to the operator: challenge type, domain, and print.
…nginx

and Apache (more to come).  Inspired by kristapsdz#32 --- thanks!
You need to ensure the arguments passed to `<ctype.h>` functions are `unsigned char` values or `EOF`. Casting to `int` makes no difference here; that conversion would've been implicitly performed anyway due to the type of the function... what you need to do is cast to `unsigned char`.

If you need to understand why this is the case, consider that the argument for character type functions might be used as an index for an array... and negative values would cause negative indexes, leading to a situation where attackers might be able to bleed sensitive parts of program context.
@Sebbyastian
Copy link
Author

While I'm on this function, a domain name is a list of labels, conventionally we separate those labels with periods... so the periods aren't really a part of the domain name per se. It's probably a bad idea to consider "..", "." and "" valid domain names.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant