crypto/des/des.c:571: error: INTEGER_OVERFLOW_L2
  ([0, 223] - [-8415, 65528]):unsigned32 by call to `uufread`.
Showing all 7 steps of the trace


crypto/des/des.c:571:8: Call
569.   			if (ex) {
570.   				if (uflag)
571.   					l=uufread(buf,1,BUFSIZE,DES_IN);
              ^
572.   				else
573.   					l=fread(buf,1,BUFSIZE,DES_IN);

crypto/des/des.c:754:1: <LHS trace>
752.   
753.   /* int size:  should always be > ~ 60; I actually ignore this parameter :-)    */
754. > int uufread(unsigned char *out, int size, unsigned int num, FILE *fp)
755.   	{
756.   	int i,j,tot;

crypto/des/des.c:754:1: Parameter `num`
  752.   
  753.   /* int size:  should always be > ~ 60; I actually ignore this parameter :-)    */
  754. > int uufread(unsigned char *out, int size, unsigned int num, FILE *fp)
  755.   	{
  756.   	int i,j,tot;

crypto/des/des.c:754:1: <RHS trace>
752.   
753.   /* int size:  should always be > ~ 60; I actually ignore this parameter :-)    */
754. > int uufread(unsigned char *out, int size, unsigned int num, FILE *fp)
755.   	{
756.   	int i,j,tot;

crypto/des/des.c:754:1: Parameter `num`
  752.   
  753.   /* int size:  should always be > ~ 60; I actually ignore this parameter :-)    */
  754. > int uufread(unsigned char *out, int size, unsigned int num, FILE *fp)
  755.   	{
  756.   	int i,j,tot;

crypto/des/des.c:804:4: Assignment
  802.   			{
  803.   			/* num to copy to make it a multiple of 8 */
  804.   			j=(num/8*8)-tot-8;
            ^
  805.   			memcpy(&(out[tot]),bb,(unsigned int)j);
  806.   			tot+=j;

crypto/des/des.c:807:4: Binary operation: ([0, 223] - [-8415, 65528]):unsigned32 by call to `uufread` 
  805.   			memcpy(&(out[tot]),bb,(unsigned int)j);
  806.   			tot+=j;
  807.   			memcpy(bb,&(bb[j]),(unsigned int)i-j);
            ^
  808.   			valid=i-j;
  809.   			break;

int uufread(unsigned char *out, int size, unsigned int num, FILE *fp)
	{
	int i,j,tot;
	static int done=0;
	static int valid=0;
	static int start=1;
	if (start)
		{
		for (;;)
			{
			b[0]='\0';
			fgets((char *)b,300,fp);
			if (b[0] == '\0')
				{
				fprintf(stderr,"no 'begin' found in uuencoded input\n");
				return(-1);
				}
			if (strncmp((char *)b,"begin ",6) == 0) break;
			}
		start=0;
		}
	if (done) return(0);
	tot=0;
	if (valid)
		{
		memcpy(out,bb,(unsigned int)valid);
		tot=valid;
		valid=0;
		}
	for (;;)
		{
		b[0]='\0';
		fgets((char *)b,300,fp);
		if (b[0] == '\0') break;
		i=strlen((char *)b);
		if ((b[0] == 'e') && (b[1] == 'n') && (b[2] == 'd'))
			{
			done=1;
			while (!feof(fp))
				{
				fgets((char *)b,300,fp);
				}
			break;
			}
		i=uudecode(b,i,bb);
		if (i < 0) break;
		if ((i+tot+8) > num)
			{
			j=(num/8*8)-tot-8;
			memcpy(&(out[tot]),bb,(unsigned int)j);
			tot+=j;
			memcpy(bb,&(bb[j]),(unsigned int)i-j);
			valid=i-j;
			break;
			}
		memcpy(&(out[tot]),bb,(unsigned int)i);
		tot+=i;
		}
	return(tot);
	}
['void doencryption(void)\n\t{\n#ifdef _LIBC\n\textern unsigned long time();\n#endif\n\tregister int i;\n\tdes_key_schedule ks,ks2;\n\tdes_cblock iv,iv2;\n\tchar *p;\n\tint num=0,j,k,l,rem,ll,len,last,ex=0;\n\tdes_cblock kk,k2;\n\tFILE *O;\n\tint Exit=0;\n#ifndef MSDOS\n\tstatic unsigned char buf[BUFSIZE+8],obuf[BUFSIZE+8];\n#else\n\tstatic unsigned char *buf=NULL,*obuf=NULL;\n\tif (buf == NULL)\n\t\t{\n\t\tif (    (( buf=Malloc(BUFSIZE+8)) == NULL) ||\n\t\t\t((obuf=Malloc(BUFSIZE+8)) == NULL))\n\t\t\t{\n\t\t\tfputs("Not enough memory\\n",stderr);\n\t\t\tExit=10;\n\t\t\tgoto problems;\n\t\t\t}\n\t\t}\n#endif\n\tif (hflag)\n\t\t{\n\t\tj=(flag3?16:8);\n\t\tp=key;\n\t\tfor (i=0; i<j; i++)\n\t\t\t{\n\t\t\tk=0;\n\t\t\tif ((*p <= \'9\') && (*p >= \'0\'))\n\t\t\t\tk=(*p-\'0\')<<4;\n\t\t\telse if ((*p <= \'f\') && (*p >= \'a\'))\n\t\t\t\tk=(*p-\'a\'+10)<<4;\n\t\t\telse if ((*p <= \'F\') && (*p >= \'A\'))\n\t\t\t\tk=(*p-\'A\'+10)<<4;\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tfputs("Bad hex key\\n",stderr);\n\t\t\t\tExit=9;\n\t\t\t\tgoto problems;\n\t\t\t\t}\n\t\t\tp++;\n\t\t\tif ((*p <= \'9\') && (*p >= \'0\'))\n\t\t\t\tk|=(*p-\'0\');\n\t\t\telse if ((*p <= \'f\') && (*p >= \'a\'))\n\t\t\t\tk|=(*p-\'a\'+10);\n\t\t\telse if ((*p <= \'F\') && (*p >= \'A\'))\n\t\t\t\tk|=(*p-\'A\'+10);\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tfputs("Bad hex key\\n",stderr);\n\t\t\t\tExit=9;\n\t\t\t\tgoto problems;\n\t\t\t\t}\n\t\t\tp++;\n\t\t\tif (i < 8)\n\t\t\t\tkk[i]=k;\n\t\t\telse\n\t\t\t\tk2[i-8]=k;\n\t\t\t}\n\t\tdes_set_key(&k2,ks2);\n\t\tmemset(k2,0,sizeof(k2));\n\t\t}\n\telse if (longk || flag3)\n\t\t{\n\t\tif (flag3)\n\t\t\t{\n\t\t\tdes_string_to_2keys(key,&kk,&k2);\n\t\t\tdes_set_key(&k2,ks2);\n\t\t\tmemset(k2,0,sizeof(k2));\n\t\t\t}\n\t\telse\n\t\t\tdes_string_to_key(key,&kk);\n\t\t}\n\telse\n\t\tfor (i=0; i<KEYSIZ; i++)\n\t\t\t{\n\t\t\tl=0;\n\t\t\tk=key[i];\n\t\t\tfor (j=0; j<8; j++)\n\t\t\t\t{\n\t\t\t\tif (k&1) l++;\n\t\t\t\tk>>=1;\n\t\t\t\t}\n\t\t\tif (l & 1)\n\t\t\t\tkk[i]=key[i]&0x7f;\n\t\t\telse\n\t\t\t\tkk[i]=key[i]|0x80;\n\t\t\t}\n\tdes_set_key(&kk,ks);\n\tmemset(key,0,sizeof(key));\n\tmemset(kk,0,sizeof(kk));\n\tmemset(iv,0,sizeof(iv));\n\tmemset(iv2,0,sizeof(iv2));\n\tl=1;\n\trem=0;\n\tif (eflag || (!dflag && cflag))\n\t\t{\n\t\tfor (;;)\n\t\t\t{\n\t\t\tnum=l=fread(&(buf[rem]),1,BUFSIZE,DES_IN);\n\t\t\tl+=rem;\n\t\t\tnum+=rem;\n\t\t\tif (l < 0)\n\t\t\t\t{\n\t\t\t\tperror("read error");\n\t\t\t\tExit=6;\n\t\t\t\tgoto problems;\n\t\t\t\t}\n\t\t\trem=l%8;\n\t\t\tlen=l-rem;\n\t\t\tif (feof(DES_IN))\n\t\t\t\t{\n\t\t\t\tfor (i=7-rem; i>0; i--)\n\t\t\t\t\tRAND_bytes(buf + l++, 1);\n\t\t\t\tbuf[l++]=rem;\n\t\t\t\tex=1;\n\t\t\t\tlen+=rem;\n\t\t\t\t}\n\t\t\telse\n\t\t\t\tl-=rem;\n\t\t\tif (cflag)\n\t\t\t\t{\n\t\t\t\tdes_cbc_cksum(buf,&cksum,\n\t\t\t\t\t(long)len,ks,&cksum);\n\t\t\t\tif (!eflag)\n\t\t\t\t\t{\n\t\t\t\t\tif (feof(DES_IN)) break;\n\t\t\t\t\telse continue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tif (bflag && !flag3)\n\t\t\t\tfor (i=0; i<l; i+=8)\n\t\t\t\t\tdes_ecb_encrypt(\n\t\t\t\t\t\t(des_cblock *)&(buf[i]),\n\t\t\t\t\t\t(des_cblock *)&(obuf[i]),\n\t\t\t\t\t\tks,do_encrypt);\n\t\t\telse if (flag3 && bflag)\n\t\t\t\tfor (i=0; i<l; i+=8)\n\t\t\t\t\tdes_ecb2_encrypt(\n\t\t\t\t\t\t(des_cblock *)&(buf[i]),\n\t\t\t\t\t\t(des_cblock *)&(obuf[i]),\n\t\t\t\t\t\tks,ks2,do_encrypt);\n\t\t\telse if (flag3 && !bflag)\n\t\t\t\t{\n\t\t\t\tchar tmpbuf[8];\n\t\t\t\tif (rem) memcpy(tmpbuf,&(buf[l]),\n\t\t\t\t\t(unsigned int)rem);\n\t\t\t\tdes_3cbc_encrypt(\n\t\t\t\t\t(des_cblock *)buf,(des_cblock *)obuf,\n\t\t\t\t\t(long)l,ks,ks2,&iv,\n\t\t\t\t\t&iv2,do_encrypt);\n\t\t\t\tif (rem) memcpy(&(buf[l]),tmpbuf,\n\t\t\t\t\t(unsigned int)rem);\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tdes_cbc_encrypt(\n\t\t\t\t\tbuf,obuf,\n\t\t\t\t\t(long)l,ks,&iv,do_encrypt);\n\t\t\t\tif (l >= 8) memcpy(iv,&(obuf[l-8]),8);\n\t\t\t\t}\n\t\t\tif (rem) memcpy(buf,&(buf[l]),(unsigned int)rem);\n\t\t\ti=0;\n\t\t\twhile (i < l)\n\t\t\t\t{\n\t\t\t\tif (uflag)\n\t\t\t\t\tj=uufwrite(obuf,1,(unsigned int)l-i,\n\t\t\t\t\t\tDES_OUT);\n\t\t\t\telse\n\t\t\t\t\tj=fwrite(obuf,1,(unsigned int)l-i,\n\t\t\t\t\t\tDES_OUT);\n\t\t\t\tif (j == -1)\n\t\t\t\t\t{\n\t\t\t\t\tperror("Write error");\n\t\t\t\t\tExit=7;\n\t\t\t\t\tgoto problems;\n\t\t\t\t\t}\n\t\t\t\ti+=j;\n\t\t\t\t}\n\t\t\tif (feof(DES_IN))\n\t\t\t\t{\n\t\t\t\tif (uflag) uufwriteEnd(DES_OUT);\n\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\telse\n\t\t{\n\t\tex=1;\n\t\tfor (;;)\n\t\t\t{\n\t\t\tif (ex) {\n\t\t\t\tif (uflag)\n\t\t\t\t\tl=uufread(buf,1,BUFSIZE,DES_IN);\n\t\t\t\telse\n\t\t\t\t\tl=fread(buf,1,BUFSIZE,DES_IN);\n\t\t\t\tex=0;\n\t\t\t\trem=l%8;\n\t\t\t\tl-=rem;\n\t\t\t\t}\n\t\t\tif (l < 0)\n\t\t\t\t{\n\t\t\t\tperror("read error");\n\t\t\t\tExit=6;\n\t\t\t\tgoto problems;\n\t\t\t\t}\n\t\t\tif (bflag && !flag3)\n\t\t\t\tfor (i=0; i<l; i+=8)\n\t\t\t\t\tdes_ecb_encrypt(\n\t\t\t\t\t\t(des_cblock *)&(buf[i]),\n\t\t\t\t\t\t(des_cblock *)&(obuf[i]),\n\t\t\t\t\t\tks,do_encrypt);\n\t\t\telse if (flag3 && bflag)\n\t\t\t\tfor (i=0; i<l; i+=8)\n\t\t\t\t\tdes_ecb2_encrypt(\n\t\t\t\t\t\t(des_cblock *)&(buf[i]),\n\t\t\t\t\t\t(des_cblock *)&(obuf[i]),\n\t\t\t\t\t\tks,ks2,do_encrypt);\n\t\t\telse if (flag3 && !bflag)\n\t\t\t\t{\n\t\t\t\tdes_3cbc_encrypt(\n\t\t\t\t\t(des_cblock *)buf,(des_cblock *)obuf,\n\t\t\t\t\t(long)l,ks,ks2,&iv,\n\t\t\t\t\t&iv2,do_encrypt);\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tdes_cbc_encrypt(\n\t\t\t\t\tbuf,obuf,\n\t\t\t\t \t(long)l,ks,&iv,do_encrypt);\n\t\t\t\tif (l >= 8) memcpy(iv,&(buf[l-8]),8);\n\t\t\t\t}\n\t\t\tif (uflag)\n\t\t\t\tll=uufread(&(buf[rem]),1,BUFSIZE,DES_IN);\n\t\t\telse\n\t\t\t\tll=fread(&(buf[rem]),1,BUFSIZE,DES_IN);\n\t\t\tll+=rem;\n\t\t\trem=ll%8;\n\t\t\tll-=rem;\n\t\t\tif (feof(DES_IN) && (ll == 0))\n\t\t\t\t{\n\t\t\t\tlast=obuf[l-1];\n\t\t\t\tif ((last > 7) || (last < 0))\n\t\t\t\t\t{\n\t\t\t\t\tfputs("The file was not decrypted correctly.\\n",\n\t\t\t\t\t\tstderr);\n\t\t\t\t\tExit=8;\n\t\t\t\t\tlast=0;\n\t\t\t\t\t}\n\t\t\t\tl=l-8+last;\n\t\t\t\t}\n\t\t\ti=0;\n\t\t\tif (cflag) des_cbc_cksum(obuf,\n\t\t\t\t(des_cblock *)cksum,(long)l/8*8,ks,\n\t\t\t\t(des_cblock *)cksum);\n\t\t\twhile (i != l)\n\t\t\t\t{\n\t\t\t\tj=fwrite(obuf,1,(unsigned int)l-i,DES_OUT);\n\t\t\t\tif (j == -1)\n\t\t\t\t\t{\n\t\t\t\t\tperror("Write error");\n\t\t\t\t\tExit=7;\n\t\t\t\t\tgoto problems;\n\t\t\t\t\t}\n\t\t\t\ti+=j;\n\t\t\t\t}\n\t\t\tl=ll;\n\t\t\tif ((l == 0) && feof(DES_IN)) break;\n\t\t\t}\n\t\t}\n\tif (cflag)\n\t\t{\n\t\tl=0;\n\t\tif (cksumname[0] != \'\\0\')\n\t\t\t{\n\t\t\tif ((O=fopen(cksumname,"w")) != NULL)\n\t\t\t\t{\n\t\t\t\tCKSUM_OUT=O;\n\t\t\t\tl=1;\n\t\t\t\t}\n\t\t\t}\n\t\tfor (i=0; i<8; i++)\n\t\t\tfprintf(CKSUM_OUT,"%02X",cksum[i]);\n\t\tfprintf(CKSUM_OUT,"\\n");\n\t\tif (l) fclose(CKSUM_OUT);\n\t\t}\nproblems:\n\tmemset(buf,0,sizeof(buf));\n\tmemset(obuf,0,sizeof(obuf));\n\tmemset(ks,0,sizeof(ks));\n\tmemset(ks2,0,sizeof(ks2));\n\tmemset(iv,0,sizeof(iv));\n\tmemset(iv2,0,sizeof(iv2));\n\tmemset(kk,0,sizeof(kk));\n\tmemset(k2,0,sizeof(k2));\n\tmemset(uubuf,0,sizeof(uubuf));\n\tmemset(b,0,sizeof(b));\n\tmemset(bb,0,sizeof(bb));\n\tmemset(cksum,0,sizeof(cksum));\n\tif (Exit) EXIT(Exit);\n\t}', 'int uufread(unsigned char *out, int size, unsigned int num, FILE *fp)\n\t{\n\tint i,j,tot;\n\tstatic int done=0;\n\tstatic int valid=0;\n\tstatic int start=1;\n\tif (start)\n\t\t{\n\t\tfor (;;)\n\t\t\t{\n\t\t\tb[0]=\'\\0\';\n\t\t\tfgets((char *)b,300,fp);\n\t\t\tif (b[0] == \'\\0\')\n\t\t\t\t{\n\t\t\t\tfprintf(stderr,"no \'begin\' found in uuencoded input\\n");\n\t\t\t\treturn(-1);\n\t\t\t\t}\n\t\t\tif (strncmp((char *)b,"begin ",6) == 0) break;\n\t\t\t}\n\t\tstart=0;\n\t\t}\n\tif (done) return(0);\n\ttot=0;\n\tif (valid)\n\t\t{\n\t\tmemcpy(out,bb,(unsigned int)valid);\n\t\ttot=valid;\n\t\tvalid=0;\n\t\t}\n\tfor (;;)\n\t\t{\n\t\tb[0]=\'\\0\';\n\t\tfgets((char *)b,300,fp);\n\t\tif (b[0] == \'\\0\') break;\n\t\ti=strlen((char *)b);\n\t\tif ((b[0] == \'e\') && (b[1] == \'n\') && (b[2] == \'d\'))\n\t\t\t{\n\t\t\tdone=1;\n\t\t\twhile (!feof(fp))\n\t\t\t\t{\n\t\t\t\tfgets((char *)b,300,fp);\n\t\t\t\t}\n\t\t\tbreak;\n\t\t\t}\n\t\ti=uudecode(b,i,bb);\n\t\tif (i < 0) break;\n\t\tif ((i+tot+8) > num)\n\t\t\t{\n\t\t\tj=(num/8*8)-tot-8;\n\t\t\tmemcpy(&(out[tot]),bb,(unsigned int)j);\n\t\t\ttot+=j;\n\t\t\tmemcpy(bb,&(bb[j]),(unsigned int)i-j);\n\t\t\tvalid=i-j;\n\t\t\tbreak;\n\t\t\t}\n\t\tmemcpy(&(out[tot]),bb,(unsigned int)i);\n\t\ttot+=i;\n\t\t}\n\treturn(tot);\n\t}']