Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- sh.old.c 2010-08-26 23:56:00.000000000 +0200
- +++ sh.new.c 2010-08-27 00:02:46.000000000 +0200
- @@ -46,21 +46,21 @@
- password = malloc(sizeof(char));
- text = malloc(sizeof(char));
- printf(">>> Username: ");
- - i=0;
- - while((username[i] = getchar())!='\n')
- - username = realloc(username,sizeof(char)*++i);
- - username[i] = '\0';
- + l1=1;
- + while((username[l1 - 1] = getchar())!='\n')
- + username = realloc(username,sizeof(char)*++l1);
- + username[l1 - 1] = '\0';
- printf(">>> Password: ");
- - i=0;
- - while((password[i] = getchar())!='\n')
- - password = realloc(password,sizeof(char)*++i);
- - password[i] = '\0';
- - i=0;
- + l2=1;
- + while((password[l2 - 1] = getchar())!='\n')
- + password = realloc(password,sizeof(char)*++l2);
- + password[l2 - 1] = '\0';
- + i=1;
- printf(">>> Text [CTRL-X + Return]:\n");
- - while((text[i] = getchar())!=24) /* 24 == ctrl + x */
- - if(text[i] != '\b')
- + while((text[i - 1] = getchar())!=24) /* 24 == ctrl + x */
- + if(text[i - 1] != '\b')
- text = realloc(text,sizeof(char)*++i);
- - text[i] = '\0';
- + text[i - 1] = '\0';
- use_text = 1;
- printf("\n");
- }
- @@ -69,10 +69,9 @@
- username = strdup(argv[1]);
- password = strdup(argv[2]);
- use_text = 0;
- - }
- -
- l1 = strlen(username);
- l2 = strlen(password);
- + }
- user.sin_family = AF_INET;
- user.sin_port = htons(80);
- @@ -150,7 +149,7 @@
- fsize = ftell(fp);
- rewind(fp);
- buff = malloc(sizeof(char)*fsize);
- - fread(buff,fsize,1,fp);
- + fread(buff,1,fsize,fp);
- buff[fsize-1]='\0';
- fclose(fp);
- len = MAX + fsize + 21;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement