What buffer? What problem?
Do you really expect an answer? There are no mind readers here and our crystal balls are cracked.
Well, buffer overflow is a not a secret, and any C++ programmer should be aware of it. If you are not, just relax and let those who have, give their opinions.
And btw, I have noticed your rude answers in most threads. You might wanna stop answering since you're not so helpful anyway.
If you try to write or read to/from an array with an index either < 0 or >= ArraySize() you'll get an error and the program stops anything else has never happened to me.
You posted a vague question, you got a vague answer and a request for more information which you never provided. "You might wanna stop asking because you are not going to get helpful answers that way." How To Ask Questions The Smart Way Dealing with rudeness
If my understanding of English is correct, William is not rude (never). He is harsh, a native English speaking user could confirm ? It's a pity he never understood it and how it's unpleasant. However the funny thing is you are yourself often harsh too, are you aware about that ? And additionally you are wrong, William is the most helpful guy on this forum, he had helped hundreds if not thousands people.
Beside that he is right, your question is vague, do you face any real problem or is it just a theoretical question ?
MQL is a managed language, you don't have direct access to memory and should never have a buffer overflow because the platform will catch it before.
You may also be interested by #property stacksize. See documentation.
Is my post helpful enough ? (Here I am sarcastic, not rude or harsh).
Short answer: no.
In the sense you're asking about, MQL is more similar to something like C# than C++. Memory access is "managed". MQL code doesn't have raw memory pointers and can't directly address any arbitrary section of memory in the same way as C/C++.
But various types of invalid-memory exception remain possible, as they do in comparable languages such as C# or Java. For example: out-of-bounds access to an array, or trying to use an object which has been deleted.
You may also be interested by #property stacksize.
Stack overflow obvs very different to buffer overflow. Stack overflow is perfectly possible in MQL, as in any language, but very largely limited to [broken] recursion rather than how variables are declared - because of the way MQL and its compiler manage memory creation and access.
Now that I look at it - never needed to before - #property stacksize isn't very well documented.
https://docs.mql4.com/basis/preprosessor/compilation says that "at least 8MB" is allocated for an EA or script. But the MQL4 version of the description links through to https://docs.mql4.com/basis/variables/local#stack. That says that the "default stack size is 256 kb", which looks like an outdated reference which hasn't been updated. (MQL5 version has been updated.)
The description of #property stacksize doesn't say whether you define the value in bytes, kilobytes, megabytes etc. Looks to me like it's bytes, but with something which isn't entirely explicit in the documentation: MQL will ignore values smaller than the default. If you try to use #property stacksize to allocate less than 8MB (in a script), you still get 8MB. The "at least" in the description seems to mean that MQL will allocate 8MB or #property stacksize if larger; not that MQL will always allocate 8MB and may itself decide to allocate more.
Didn't strike me as any more vague than the perennial question about "what other language is MQL most like?" Or something like https://www.mql5.com/en/forum/210326, which WR answered far more helpfully...