Programming tip #5 — never use strcpy()

Kosta Zertsekel
Sep 1, 2018 · 1 min read

Actually, there is a whole list of functions in the standard C library (libc) that should never be used in your project!

Let’s mention those that can lead to buffer overflow errors.

They are:

  • gets()
  • strcpy()
  • strcat()

All these functions are part of the standard library and they can lead to a buffer overflow errors.

They are still not deprecated by the standard library itself, but may be it is going to happen down the line.

Instead — use the below replacement functions:

  • fgets()
  • strncpy()
  • strncat()

—Kosta Z

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade