Appeal from a judgment of the Supreme Court at Special Term (Shea, J.), entered February 14,1981 in Washington County, which denied a writ of habeas corpus without a hearing. On July 24, 1979 in *676Orange County, petitioner pleaded guilty to sodomy, second degree, in full satisfaction of the indictment which also contained a charge of rape in the second degree. He was sentenced to an indeterminate term of zero to seven years’ imprisonment. On August 29, 1980, petitioner made application for a writ of habeas corpus based on the alleged insufficiency of the indictment and, in particular, on its failure to allege adequately the crimes charged. The petition does not state whether petitioner appealed his conviction. Regardless, an examination of the indictment discloses its legal sufficiency and its charge of all the material elements of the crime to which petitioner pleaded (People v Iannone, 45 NY2d 589). The indictment was, therefore, jurisdictionally effective and the plea to its first count waived any lesser claim of insufficiency. Accordingly, the detention of petitioner is not wrongful and the writ was properly denied by Special Term. Judgment affirmed, without costs. Main, J.P., Casey, Mikoll, Yesawich, Jr., and Weiss, JJ., concur.