Codebase list tlsh / cce1f56
Fixed potential buffer overflow warnings. Vic Hargrave 8 years ago
1 changed file(s) with 6 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
145145 int n_file = 0;
146146 while (dit != NULL) {
147147 char tmp_fname[2000];
148 strncpy(tmp_fname, dirname, sizeof(tmp_fname));
149 strncat(tmp_fname, "/", sizeof(tmp_fname));
150 strncat(tmp_fname, dit->d_name, sizeof(tmp_fname));
148 strncpy(tmp_fname, dirname, sizeof(tmp_fname)-1);
149 strncat(tmp_fname, "/", sizeof(tmp_fname)-1);
150 strncat(tmp_fname, dit->d_name, sizeof(tmp_fname)-1);
151151 if (strlen(tmp_fname) < sizeof(tmp_fname) - 2) {
152152 if (is_dir(tmp_fname) ) {
153153 if ((strcmp(dit->d_name, ".") == 0) || (strcmp(dit->d_name, "..") == 0)) {
179179 dit = readdir(dip);
180180 while (dit != NULL) {
181181 char tmp_fname[2000];
182 strncpy(tmp_fname, dirname, sizeof(tmp_fname));
183 strncat(tmp_fname, "/", sizeof(tmp_fname));
184 strncat(tmp_fname, dit->d_name, sizeof(tmp_fname));
182 strncpy(tmp_fname, dirname, sizeof(tmp_fname)-1);
183 strncat(tmp_fname, "/", sizeof(tmp_fname)-1);
184 strncat(tmp_fname, dit->d_name, sizeof(tmp_fname)-1);
185185 // -2 for safety
186186 if (strlen(tmp_fname) < sizeof(tmp_fname) - 2) {
187187 if (is_dir(tmp_fname) ) {