diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-09-19 10:15:19 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-09-19 10:15:19 +0300 |
commit | 4e9aadac5e7756b0bf3d313ec31cc85770347b8a (patch) | |
tree | c043c2e7dd0405727928313591a19f440a262fa1 /source/blender/windowmanager | |
parent | 86590b90aa78c7087a588275030a4f1490e37297 (diff) |
Fix T70033: Crash editing keymap operator
Expanding operator names could buffer overrun.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 9657347a1c4..6da9c13d1cf 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -140,13 +140,13 @@ void WM_operator_bl_idname(char *to, const char *from) if (from) { const char *sep = strchr(from, '.'); - if (sep) { - int ofs = (sep - from); - + int from_len; + if (sep && (from_len = strlen(from)) < OP_MAX_TYPENAME - 3) { + const int ofs = (sep - from); memcpy(to, from, sizeof(char) * ofs); BLI_str_toupper_ascii(to, ofs); - strcpy(to + ofs, "_OT_"); - strcpy(to + (ofs + 4), sep + 1); + memcpy(to + ofs, "_OT_", 4); + memcpy(to + (ofs + 4), sep + 1, (from_len - ofs)); } else { /* should not happen but support just in case */ |