diff --git a/src/refresh/files/jpeg.c b/src/refresh/files/jpeg.c index d672da7c..6d09e17c 100644 --- a/src/refresh/files/jpeg.c +++ b/src/refresh/files/jpeg.c @@ -92,7 +92,7 @@ LoadJPG(char *origname, byte **pic, int *width, int *height) len = strlen(filename); if (len >= 4 && strcmp(filename + len - 4, ".jpg")) { - strncat(filename, ".jpg", sizeof(filename) - 1 - len); + Q_strlcat(filename, ".jpg", sizeof(filename)); } *pic = NULL; diff --git a/src/refresh/files/pcx.c b/src/refresh/files/pcx.c index 51ab8f4f..61e15b8f 100644 --- a/src/refresh/files/pcx.c +++ b/src/refresh/files/pcx.c @@ -45,7 +45,7 @@ LoadPCX(char *origname, byte **pic, byte **palette, int *width, int *height) filelen = strlen(filename); if (filelen >= 4 && strcmp(filename + filelen - 4, ".pcx")) { - strncat(filename, ".pcx", sizeof(filename) - 1 - filelen); + Q_strlcat(filename, ".pcx", sizeof(filename)); } *pic = NULL; diff --git a/src/refresh/files/tga.c b/src/refresh/files/tga.c index ce6c4810..a4724630 100644 --- a/src/refresh/files/tga.c +++ b/src/refresh/files/tga.c @@ -57,7 +57,7 @@ LoadTGA(char *origname, byte **pic, int *width, int *height) len = strlen(name); if (len >= 4 && strcmp(name + len - 4, ".tga")) { - strncat(name, ".tga", sizeof(name) - 1 - len); + Q_strlcat(name, ".tga", sizeof(name)); } *pic = NULL; diff --git a/src/refresh/files/wal.c b/src/refresh/files/wal.c index 2822bae0..677c8751 100644 --- a/src/refresh/files/wal.c +++ b/src/refresh/files/wal.c @@ -42,7 +42,7 @@ LoadWal(char *origname) len = strlen(name); if (len >= 4 && strcmp(name + len - 4, ".wal")) { - strncat(name, ".wal", sizeof(name) - 1 - len); + Q_strlcat(name, ".wal", sizeof(name)); } ri.FS_LoadFile(name, (void **)&mt); diff --git a/src/server/sv_save.c b/src/server/sv_save.c index 01f1f387..2e01164b 100644 --- a/src/server/sv_save.c +++ b/src/server/sv_save.c @@ -243,8 +243,7 @@ SV_WriteServerFile(qboolean autosave) newtime->tm_hour, newtime->tm_min / 10, newtime->tm_min % 10, newtime->tm_mon + 1, newtime->tm_mday); - strncat(comment, sv.configstrings[CS_NAME], - sizeof(comment) - 1 - strlen(comment)); + Q_strlcat(comment, sv.configstrings[CS_NAME], sizeof(comment)); } else {