Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
42 user(s) are online (28 user(s) are browsing Forums)

Members: 0
Guests: 42

more...

Headlines

Report message:*
 

Re: Horny Source code on Github

Subject: Re: Horny Source code on Github
by xenic on 2020/1/20 21:37:56

@Capehill

Quote:
Anyway, check that "str" is a valid pointer before strncpy.

Yep. That could be a problem if it's NULL.

Quote:
Also If "str" points to a string that is longer than 1023 characters, there will not be NUL termination.

That's a good reason to switch to more modern "strlcpy". It always terminates the copy with a NULL.
Maybe something like:
strlcpy(lied.phonolithprojekt, str, sizeof(lied.phonolithprojekt)); (https://linux.die.net/man/3/strlcpy)

Since "lied.phonolithprojekt" appears in a number of program files, it might be a good idea to initialize it in the structure declaration with something like "unnamed project".

Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project