Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Worse is Better

Name: Anonymous 2011-05-25 14:43

Name: Anonymous 2011-05-25 14:49

Best C code I've ever seen.

Name: Anonymous 2011-05-25 15:05

The best possible getpass() you could get away with is to declare a static char array variable which you return a pointer to

char* getpass(void)
{
static char password[10];
scanf("%9s\n", password);
return password;
}

However this makes the function non-thread-safe and non-renterant which limits its use, and as well as that you end up storing the password in memory for the permanent life of the program.
Oh no, not 10 bytes!

Name: Anonymous 2011-05-25 16:09

>>3
What
the
fuck
Learn
to
quote

Name: Anonymous 2011-05-25 16:12

>>4
dunno how

Name: Anonymous 2011-05-25 16:16

The correct way to solve this is using a 50K buffer (on the stack, like the original program does), and putting the string 24K in. It is unlikely that any implementation of strcpy() will use that much stack, so the string will remain safe. It will take a lot of abuse until it's overwritten, and if it does, you can just increase the buffer.

Name: Anonymous 2011-05-25 16:18

I can't quote either

Name: Anonymous 2011-05-25 16:19

>>3
I assume you use an environment that doesn't let you look at memory contents ever, then?

Name: Anonymous 2011-05-25 16:21

>>3
You start like that and you end with a 5MB .bss and compile errors on certain architectures. Also, maybe you missed the other half of you're quote.

Name: Anonymous 2011-05-25 16:21

me 2

Name: Anonymous 2011-05-25 17:04































newfags can't specialquote (btw many thx 2 teh guy who poasted hw 2 epic quote)





























Name: Anonymous 2011-05-25 17:09

>>8-9
I don't think you understand the point I was making.

Name: Anonymous 2011-05-25 17:11

>>12
It was the wrong point.

Name: Anonymous 2011-05-25 17:13

Name: Anonymous 2013-09-01 19:28



      ',         ||         //      / ./
     ',       |  _,,,,.....,,,/_      //            ,.  '"
     ',     , '"´    r‐-、___`>、 /            ,.  '"
          /      _,,.. -─- 、..,,_ ヽ.       ,.  '"
  /´ ̄`ヽ<     , '"´        `ヽ}   ,.  '"
 /   ⌒ヽ(::::l))__,>'"´ ̄ ̄ ̄`"' ー- 、   \        /\
 |       ア´ /    、 /|   ,     \   } 、     /  /
 ヽ     `Y  ,'     /メ、|__/|    ,!   ヽ,ハ |  __/  /___
   ',    | /    /ァ' ⌒ヽ  ,'  / | |  !/ ./  /_       / - ─=
  ノ ヽ   | \__/ |7   ∩ く__/-/_./  |/    /  / ̄/  / _ _  />
, '´   |  ,'    ./  八   り       r!7|  /ハ    /_/  /  / /_/ /_///
!    ノ_ノ,   く__/|  `'ー      ヽY././ | ○     /_/    ∠/
'、  (   /   ヽ  ハ "   /´  ̄ ヽ  ト/ /    。  人       人
 ヽ.  ハ |へ、  ∧ | u  ,'  ̄`ヽ } ,ハ ,' o   )ー '"  `''ー--‐''"  `''ー
   \|´    \/レ' |/\  l_      /   } |   <
   ,..::'"´ア´ ̄ ̄Y| ̄\ > 、,_,,.イ∧_/ |     )  そんな事をすれば
. /::::::::/      、|}   \__/\ レ'  |  / \  く    川が汚染されるぞ!
/::::/こ>、    八、    /ム  ト、   //    \ )
::::/   ヽ/    /  \ /   \{ ,ハ ´       ⌒ヽr─-、  , -─- 、 , -─

Don't change these.
Name: Email:
Entire Thread Thread List