From: Adam Dickmeiss Date: Mon, 26 Aug 2002 09:25:56 +0000 (+0000) Subject: Buffer overflow fix X-Git-Tag: YAZ.1.9~43 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=836f6f959c8bdde0c0ecc6317ba8d274d868e9e0 Buffer overflow fix --- diff --git a/util/atoin.c b/util/atoin.c index 3b5953a..4642cb0 100644 --- a/util/atoin.c +++ b/util/atoin.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: atoin.c,v $ - * Revision 1.3 2000-02-29 13:44:55 adam + * Revision 1.4 2002-08-26 09:25:56 adam + * Buffer overflow fix + * + * Revision 1.3 2000/02/29 13:44:55 adam * Check for config.h (currently not generated). * * Revision 1.2 1999/11/30 13:47:12 adam @@ -35,3 +38,34 @@ int atoi_n (const char *buf, int len) } return val; } + +/* + UCS-4 <- ISO-8859-1 + (unsigned long) ch = ch & 255; + + ISO-8859-1 -> UCS-4 + if (ch > 255) + invalid sequence + else + ch = ch; + + UCS-4 -> UTF-8 + if (ch <= 0x7f) + ch = ch; + else if c(h <= 0x7ff) + { + str[0] = 0xc0 + (ch & (0xff < 6)); + str[1] = 0x80 + ch & 0x7ff; + } + else if (ch <= 0xffff) + { + + + + } + + + +*/ + + diff --git a/util/oid.c b/util/oid.c index 6a41916..cbbc81f 100644 --- a/util/oid.c +++ b/util/oid.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2002, Index Data * See the file LICENSE for details. * - * $Id: oid.c,v 1.55 2002-04-12 14:40:21 adam Exp $ + * $Id: oid.c,v 1.56 2002-08-26 09:25:56 adam Exp $ */ /* @@ -474,7 +474,7 @@ struct oident *oid_addent (int *oid, enum oid_proto proto, int i; sprintf (desc_str, "%d", *oid); - for (i = 1; oid[i] >= 0; i++) + for (i = 1; i < 12 && oid[i] >= 0; i++) sprintf (desc_str+strlen(desc_str), ".%d", oid[i]); desc = desc_str; }