diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2018-02-26 11:05:12 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-02-26 11:05:12 -0300 |
commit | 858af2505fe80e4175121ada95714443ea63e4de (patch) | |
tree | 062ab3e9e036f21edd2a4b7efab5988b61a96a1a /RichString.h | |
parent | 655c7293d2f984a52fba43d19fbd15d102992eb6 (diff) |
Protect against overflows in RichString_setAttrn
Diffstat (limited to 'RichString.h')
-rw-r--r-- | RichString.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/RichString.h b/RichString.h index 796965ac..f5b5cba1 100644 --- a/RichString.h +++ b/RichString.h @@ -59,6 +59,10 @@ typedef struct RichString_ { } RichString; +#ifndef CLAMP +#define CLAMP(x,low,high) (((x)>(high))?(high):(((x)<(low))?(low):(x))) +#endif + #define charBytes(n) (sizeof(CharType) * (n)) #define RichString_setLen(this, len) do{ if(len < RICHSTRING_MAXLEN && this->chlen < RICHSTRING_MAXLEN) { RichString_setChar(this,len,0); this->chlen=len; } else RichString_extendLen(this,len); }while(0) |