Skip to content

Commit

Permalink
Fix CVE-2012-2944: upsd can be remotely crashed
Browse files Browse the repository at this point in the history
NUT server (upsd), from versions 2.4.0 to 2.6.3,  are exposed to
crashes when receiving random data from the network.

This issue is related to the way NUT parses characters, especially
from the network. Non printable characters were missed from strings
operation (such as strlen), but still copied to the buffer, causing
an overflow.

Thus, fix NUT parser, to only allow the subset Ascii charset from
Space to ~

(Reported by Sebastian Pohle, Alioth bug #313636, CVE-2012-2944)

Fossil-ID: SVN r3633
  • Loading branch information
aquette committed May 29, 2012
1 parent a52c583 commit 2d6b472
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions common/parseconf.c
Expand Up @@ -171,6 +171,13 @@ static void addchar(PCONF_CTX_t *ctx)

wbuflen = strlen(ctx->wordbuf);

/* CVE-2012-2944: only allow the subset Ascii charset from Space to ~ */
if ((ctx->ch < 0x20) || (ctx->ch > 0x7f)) {
fprintf(stderr, "addchar: discarding invalid character (0x%02x)!\n",
ctx->ch);
return;
}

if (ctx->wordlen_limit != 0) {
if (wbuflen >= ctx->wordlen_limit) {

Expand Down

0 comments on commit 2d6b472

Please sign in to comment.