• Welcome to Valhalla Legends Archive.
 

Rich Edit control's EM_GETSELTEXT

Started by brew, September 13, 2007, 08:04 PM

Previous topic - Next topic

brew

http://msdn2.microsoft.com/en-us/library/bb774190.aspx
Am I crazy, or should wParam be the max buffer length for the char array that you supply the pointer to in the lParam? This message is very poorly designed. What were they thinking, having the wParam not used? This can easily be exploited by just over-selecting text, and the amount of text in a rich edit box could get quite lengthy. To be completely honest, I'm scared to even try it. Somehow I really doubt that Microsoft would make their rich edit message handlers this insecure, so is there a better way to determine how big your buffer should be? Besides using EM_GETTEXTLENGTHEX?
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

Barabajagal

How can you over-select text? GetSelText gets the selection, it doesn't set it.

Zorm

"Now, gentlemen, let us do something today which the world make talk of hereafter."
- Admiral Lord Collingwood

brew

Quote from: Andy on September 13, 2007, 09:38 PM
How can you over-select text? GetSelText gets the selection, it doesn't set it.
Say your buffer is 1024 bytes. You select 1536 characters. Those characters happen to be binary data. You fail, buffer overflow. I was asking if there was a way to determine how big your buffer should be before you use EM_GETSELTEXT.
By the way, thank you Zorm.
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P