Code Monkey home page Code Monkey logo

typp's People

Contributors

anthhon avatar iikrllx avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

anthhon

typp's Issues

Buffer Overflow Error in English/Russian Mode

Description:

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.