Branch: Tag:

2003-01-20

2003-01-20 18:01:50 by Martin Nilsson <mani@lysator.liu.se>

strlen -> sizeof

Rev: bin/fake_dynamic_load.pike:1.6
Rev: bin/httpd.pike:1.5
Rev: bin/install.pike:1.109
Rev: bin/mkpeep.pike:1.30
Rev: bin/tarfilter.pike:1.4
Rev: bin/test_pike.pike:1.80
Rev: bin/unbug:1.10
Rev: lib/modules/ADT.pmod/struct.pike:1.11
Rev: lib/modules/Audio.pmod/Format.pmod/module.pmod:1.6
Rev: lib/modules/Calendar.pmod/Events.pmod:1.13
Rev: lib/modules/Calendar.pmod/Time.pmod:1.22
Rev: lib/modules/Calendar.pmod/Timezone.pmod:1.27
Rev: lib/modules/Calendar.pmod/YMD.pmod:1.48
Rev: lib/modules/Calendar.pmod/mkrules.pike:1.7
Rev: lib/modules/Colors.pmod:1.13
Rev: lib/modules/Crypto/_rsa.pike:1.7
Rev: lib/modules/Crypto/des3.pike:1.8
Rev: lib/modules/Crypto/dsa.pike:1.12
Rev: lib/modules/Crypto/hmac.pike:1.9
Rev: lib/modules/Crypto/randomness.pmod:1.24
Rev: lib/modules/Crypto/rsa.pike:1.32
Rev: lib/modules/Filesystem.pmod/System.pike:1.14
Rev: lib/modules/Filesystem.pmod/Tar.pmod:1.19
Rev: lib/modules/GTKSupport.pmod/MenuFactory.pmod:1.8
Rev: lib/modules/Getopt.pmod:1.26
Rev: lib/modules/Languages.pmod/PLIS.pmod:1.15
Rev: lib/modules/Locale.pmod/module.pmod:1.16
Rev: lib/modules/MIME.pmod/module.pmod:1.6
Rev: lib/modules/Parser.pmod/C.pmod:1.38
Rev: lib/modules/Parser.pmod/XML.pmod/DOM.pmod:1.10
Rev: lib/modules/Parser.pmod/XML.pmod/NSTree.pmod:1.7
Rev: lib/modules/Parser.pmod/XML.pmod/Tree.pmod:1.25
Rev: lib/modules/Process.pmod:1.38
Rev: lib/modules/Protocols.pmod/DNS.pmod:1.71
Rev: lib/modules/Protocols.pmod/HTTP.pmod/Query.pike:1.48
Rev: lib/modules/Protocols.pmod/HTTP.pmod/Server.pmod/Request.pike:1.15
Rev: lib/modules/Protocols.pmod/IMAP.pmod/parse_line.pike:1.26
Rev: lib/modules/Protocols.pmod/IMAP.pmod/server.pike:1.15
Rev: lib/modules/Protocols.pmod/IMAP.pmod/types.pmod:1.28
Rev: lib/modules/Protocols.pmod/IRC.pmod/Error.pmod:1.4
Rev: lib/modules/Protocols.pmod/IRC.pmod/Raw.pike:1.7
Rev: lib/modules/Protocols.pmod/Ident.pmod:1.10
Rev: lib/modules/Protocols.pmod/LDAP.pmod/protocol.pike:1.9
Rev: lib/modules/Protocols.pmod/Line.pmod:1.21
Rev: lib/modules/Protocols.pmod/LysKOM.pmod/Helper.pmod:1.7
Rev: lib/modules/Protocols.pmod/LysKOM.pmod/Raw.pike:1.14
Rev: lib/modules/Protocols.pmod/NNTP.pmod:1.11
Rev: lib/modules/Protocols.pmod/TELNET.pmod:1.19
Rev: lib/modules/Protocols.pmod/X.pmod/KeySyms.pmod:1.3
Rev: lib/modules/Protocols.pmod/X.pmod/Requests.pmod:1.32
Rev: lib/modules/Protocols.pmod/X.pmod/Xlib.pmod:1.48
Rev: lib/modules/Protocols.pmod/X.pmod/_Xlib.pmod:1.18
Rev: lib/modules/Remote.pmod/connection.pike:1.25
Rev: lib/modules/SSL.pmod/cipher.pike:1.21
Rev: lib/modules/SSL.pmod/connection.pike:1.24
Rev: lib/modules/SSL.pmod/handshake.pike:1.30
Rev: lib/modules/SSL.pmod/https.pike:1.13
Rev: lib/modules/SSL.pmod/packet.pike:1.12
Rev: lib/modules/SSL.pmod/session.pike:1.21
Rev: lib/modules/SSL.pmod/sslfile.pike:1.51
Rev: lib/modules/SSL.pmod/state.pike:1.15
Rev: lib/modules/Sql.pmod/postgres.pike:1.19
Rev: lib/modules/Standards.pmod/ASN1.pmod/Encode.pmod:1.9
Rev: lib/modules/Standards.pmod/ASN1.pmod/Types.pmod:1.21
Rev: lib/modules/Standards.pmod/EXIF.pmod:1.16
Rev: lib/modules/Standards.pmod/ID3.pmod:1.8
Rev: lib/modules/Standards.pmod/PKCS.pmod/PFX.pmod:1.7
Rev: lib/modules/Standards.pmod/PKCS.pmod/Signature.pmod:1.7
Rev: lib/modules/Stdio.pmod/Readline.pike:1.44
Rev: lib/modules/Stdio.pmod/Terminfo.pmod:1.14
Rev: lib/modules/Stdio.pmod/module.pmod:1.163
Rev: lib/modules/String.pmod/Elite.pmod:1.3
Rev: lib/modules/String.pmod/module.pmod:1.10
Rev: lib/modules/Tools.pmod/AutoDoc.pmod/CExtractor.pmod:1.25
Rev: lib/modules/Tools.pmod/AutoDoc.pmod/DocParser.pmod:1.54
Rev: lib/modules/Tools.pmod/AutoDoc.pmod/MirarDocParser.pike:1.19
Rev: lib/modules/Tools.pmod/AutoDoc.pmod/PikeExtractor.pmod:1.30
Rev: lib/modules/Tools.pmod/AutoDoc.pmod/PikeParser.pike:1.32
Rev: lib/modules/Tools.pmod/AutoDoc.pmod/ProcessXML.pmod:1.51
Rev: lib/modules/Tools.pmod/PEM.pmod:1.9
Rev: lib/modules/Tools.pmod/Shoot.pmod/module.pmod:1.6
Rev: lib/modules/Tools.pmod/Standalone.pmod/assemble_autodoc.pike:1.25
Rev: lib/modules/Tools.pmod/X509.pmod:1.17
Rev: lib/modules/Tools.pmod/_PEM.pmod:1.5
Rev: lib/modules/Tools.pmod/sed.pmod:1.5
Rev: lib/modules/Web.pmod/Crawler.pmod:1.14
Rev: lib/modules/_Image.pmod/Fonts.pmod:1.10
Rev: lib/modules/_Image.pmod/module.pmod:1.32
Rev: lib/modules/_Image_XCF.pmod:1.20
Rev: lib/modules/_Image_XPM.pmod:1.13
Rev: src/modules/Gz/flushtest.pike:1.3
Rev: src/modules/HTTPLoop/test.pike:1.3
Rev: src/modules/HTTPLoop/wwwserver.pike:1.5
Rev: src/modules/_Charset/module.pmod.in:1.28
Rev: src/modules/files/socktest.pike:1.21
Rev: src/post_modules/GTK/new_build_pgtk.pike:1.22
Rev: src/post_modules/GTK/output/doc-pikeref.pike:1.13
Rev: src/post_modules/GTK/output/few.pike:1.2
Rev: src/post_modules/GTK/output/split.pike:1.11
Rev: src/post_modules/Unicode/make_canonicals.pike:1.2
Rev: src/post_modules/Unicode/make_decompose.pike:1.4
Rev: src/post_modules/Unicode/make_wordbits.pike:1.2
Rev: src/post_modules/Unicode/test.pike:1.6

2:      // LDAP client protocol implementation for Pike.   // - // $Id: protocol.pike,v 1.8 2002/07/22 16:15:40 bill Exp $ + // $Id: protocol.pike,v 1.9 2003/01/20 17:44:01 nilsson Exp $   //   // Honza Petrous, hop@unibase.cz   //
79:    int msglen = 0, ix, ofs;    string s, shlp;    -  if(strlen(readbuf) < 2) +  if(sizeof(readbuf) < 2)    readbuf = ldapfd->read(2); // 1. byte = 0x0C, 2. byte = msglen -  if (intp(readbuf) || (strlen(readbuf) < 2)) { +  if (intp(readbuf) || (sizeof(readbuf) < 2)) {    seterr (LDAP_TIMEOUT);    DWRITE_HI("protocol.read_anwer: ERROR: connection timeout.\n");    THROW(({"LDAP: connection timeout.\n",backtrace()}));
107:    return;    }    ofs = (msglen & 0x7f) + 2; -  ix = ofs - strlen(readbuf); +  ix = ofs - sizeof(readbuf);    if(ix > 0)    s = ldapfd->read(ix); -  if (!s || (strlen(s) < ix)) { +  if (!s || (sizeof(s) < ix)) {    seterr (LDAP_PROTOCOL_ERROR);    THROW(({"LDAP: Protocol mismatch.\n",backtrace()}));    //return(-ldap_errno);
119:    readbuf += s;    msglen = 0; // !!! RESTRICTION: 2^32 !!!    shlp = reverse(readbuf[2..ofs]); -  for (ix=0; ix<strlen(shlp); ix++) { +  for (ix=0; ix<sizeof(shlp); ix++) {    msglen += shlp[ix]*(1<<(ix*8));    }    } -  ix = (ofs + msglen) - strlen(readbuf); +  ix = (ofs + msglen) - sizeof(readbuf);    if(ix > 0)    s = ldapfd->read(ix); -  if (!s || (strlen(s) < ix)) { +  if (!s || (sizeof(s) < ix)) {    seterr (LDAP_SERVER_DOWN);    THROW(({"LDAP: connection closed by server.\n",backtrace()}));    //return(-ldap_errno);
148:    int msglen, ix, ofs;    string shlp;    -  if (strlen(readbuf) < 3) +  if (sizeof(readbuf) < 3)    return(0); // PDU have min. 3 bytes       if (readbuf[0] != '0')
159:    if (msglen == 0x80)    return(1); // forced execution    ofs = (msglen & 0x7f) + 2; -  ix = ofs - strlen(readbuf); +  ix = ofs - sizeof(readbuf);    if(ix > 0)    return(0); // incomplete PDU    msglen = 0;    shlp = reverse(readbuf[2..ofs]); -  for (ix=0; ix<strlen(shlp); ix++) { +  for (ix=0; ix<sizeof(shlp); ix++) {    msglen += shlp[ix]*(1<<(ix*8));    }    } -  ix = (ofs + msglen) - strlen(readbuf); +  ix = (ofs + msglen) - sizeof(readbuf);    if(ix > 0)    return(0); // incomplete PDU