iikrllx / typp Goto Github PK
View Code? Open in Web Editor NEWTyping Practice (ncurses).
License: GNU General Public License v3.0
Typing Practice (ncurses).
License: GNU General Public License v3.0
When attempting to utilize the program in English or Russian mode, a buffer overflow error is encountered, resulting in termination with the following message:
*** buffer overflow detected ***: terminated
Upon debugging, it was identified that the error stems from a SIGABRT
error within the getrnd_text
function:
[#0] 0x7ffff7c2800b → __GI_raise(sig=0x6)
[#1] 0x7ffff7c07859 → __GI_abort()
[#2] 0x7ffff7c7226e → __libc_message(action=do_abort, fmt=0x7ffff7d9c08f "*** %s ***: terminated\n")
[#3] 0x7ffff7d14cda → __GI___fortify_fail(msg=0x7ffff7d9c025 "buffer overflow detected")
[#4] 0x7ffff7d13576 → __GI___chk_fail()
[#5] 0x7ffff7d12e56 → __strcpy_chk(dest=0x7fffffffdd26 "", src=0x55555555a0ee "eng.typp", destlen=0x8)
[#6] 0x55555555867a → strcat(__src=<optimized out>, __dest=0x7fffffffdd10 "/usr/local/share/typp/")
[#7] 0x55555555867a → getrnd_text(main_text=0x7fffffffddb0, fname=<optimized out>, offsets=0x7fffffffde00, tsize=0x200)
[#8] 0x555555557e3f → lets_start_type()
[#9] 0x555555557e3f → main()
Further investigation revealed a potential issue within the getrnd_text
function:
static void
getrnd_text(wchar_t **main_text, size_t tsize, char *fname, int offsets[])
{
char fpath[30] = "/usr/local/share/typp/";
int j = sizeof(wchar_t), i;
FILE *stream;
wint_t c;
strcat(fpath, fname);
...
It appears that the array fpath
may not have sufficient room to accommodate the newline character \n
, leading to the buffer overflow. This issue can be addressed by increasing the size of the array, as demonstrated:
char fpath[31] = "/usr/local/share/typp/";
After implementing this modification and retesting the program, it operated without encountering any further issues. If you are interested, i can make a pull request adressing the bugfix.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.