- Timestamp:
- 09/12/20 15:27:35 (4 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Makefile
r11602 r11604 59 59 60 60 # Compiler optimizations 61 CC_OPTS = -O s-ggdb -pipe -ffunction-sections -fdata-sections61 CC_OPTS = -O2 -ggdb -pipe -ffunction-sections -fdata-sections 62 62 63 63 CC = $(CROSS_DIR)$(CROSS)gcc -
trunk/module-dvbapi-stapi.c
r11602 r11604 112 112 struct stat buf; 113 113 int32_t i; 114 char pfad[512]; 114 115 stapi_on = 1; 115 116 int32_t stapi_priority = 0; … … 123 124 124 125 memset(dev_list, 0, sizeof(struct STDEVICE)*PTINUM); 126 memset(fpad, 0, sizeof(fpad)); 125 127 126 128 if(dvbapi_priority) … … 148 150 while(!cs_readdir_r(dirp, &entry, &dp)) 149 151 { 150 if(!dp) { break; } 151 152 int n = snprintf(0, 0, "%s%s", PROCDIR, dp->d_name); 153 char *pfad = (char *)malloc(n + 1); 154 snprintf(pfad, n + 1, "%s%s", PROCDIR, dp->d_name); 152 if(!dp) 153 break; 154 155 snprintf(pfad, sizeof(pfad), "%s%s", PROCDIR, dp->d_name); 155 156 if(stat(pfad, &buf) != 0) 156 157 { continue; } -
trunk/module-dvbapi-stapi5.c
r11602 r11604 142 142 struct stat buf; 143 143 int32_t i; 144 char fpad[512]; 144 145 stapi_on = 1; 145 146 int32_t stapi_priority = 0; … … 153 154 154 155 memset(dev_list, 0, sizeof(struct STDEVICE)*PTINUM); 156 memset(fpad, 0, sizeof(fpad)); 155 157 156 158 if(dvbapi_priority) … … 181 183 if(!dp) { break; } 182 184 183 int n = snprintf(0, 0, "%s%s", PROCDIR, dp->d_name); 184 char *pfad = (char *)malloc(n + 1); 185 snprintf(pfad, n + 1, "%s%s", PROCDIR, dp->d_name); 185 snprintf(pfad, sizeof(pfad), "%s%s", PROCDIR, dp->d_name); 186 186 if(stat(pfad, &buf) != 0) 187 187 { continue; } -
trunk/module-dvbapi.c
r11583 r11604 5273 5273 DIR *dirp; 5274 5274 struct dirent entry, *dp = NULL; 5275 int32_t i, pmt_fd; 5275 int32_t i; 5276 int32_t pmt_fd = -1; 5276 5277 uint8_t mbuf[2048]; // dirty fix: larger buffer needed for CA PMT mode 6 with many parallel channels to decode 5277 5278 … … 5390 5391 } 5391 5392 #endif 5392 snprintf(dest, sizeof(dest), "%s%s", TMPDIR, dp->d_name); 5393 pmt_fd = open(dest, O_RDONLY); 5393 5394 if (!strlen(TMPDIR)) 5395 { 5396 cs_log_dbg(D_DVBAPI, "BUG! strlen(TMPDIR)!!!\n"); 5397 continue; 5398 } 5399 5400 if (!strlen(dp->d_name)) 5401 { 5402 cs_log_dbg(D_DVBAPI, "BUG! strlen(dp->d_name)!!!\n"); 5403 continue; 5404 } 5405 5406 if((strlen(dp->d_name) + strlen(TMPDIR) - 1) > sizeof(dest)) 5407 { 5408 cs_log_dbg(D_DVBAPI, "BUG! Sum of the (d_name + TMPDIR) = %u > sizeof(dest) !!!\n", (unsigned int)(strlen(dp->d_name) + strlen(TMPDIR) - 1)); 5409 continue; 5410 } 5411 else 5412 { 5413 memcpy(dest, TMPDIR, strlen(TMPDIR)); 5414 memcpy(dest + strlen(TMPDIR), dp->d_name, strlen(dp->d_name)); 5415 dest[strlen(TMPDIR) + strlen(dp->d_name)] = '\0'; 5416 pmt_fd = open(dest, O_RDONLY); 5417 } 5418 5394 5419 if(pmt_fd < 0) 5395 5420 { -
trunk/module-monitor.c
r11603 r11604 357 357 static void monitor_send_details(char *txt, uint32_t tid) 358 358 { 359 char buf[ 272];359 char buf[512]; 360 360 snprintf(buf, sizeof(buf), "[D-----]%8X|%s\n", tid, txt); 361 361 monitor_send_info(buf, 0); … … 389 389 monitor_send_details(buf, pid); 390 390 if(cfg.max_log_size) 391 { snprintf(buf + 200, 56, "%d Kb", cfg.max_log_size); } 391 { 392 snprintf(buf, 256, "MaxLogsize=%d Kb", cfg.max_log_size); 393 } 392 394 else 393 { cs_strncpy(buf + 200, "unlimited", 56); } 394 snprintf(buf, 256, "MaxLogsize=%s", buf + 200); 395 { 396 snprintf(buf, 256, "MaxLogsize=unlimited"); 397 } 395 398 monitor_send_details(buf, pid); 396 399 snprintf(buf, 256, "ClientTimeout=%u ms", cfg.ctimeout); -
trunk/module-webif-lib.c
r11570 r11604 413 413 int8_t filen = 0; 414 414 int32_t size = 0; 415 char *mimetype = "", *result = " ", *allocated = NULL; 415 char *mimetype = ""; 416 char *result = " "; 417 char *allocated = NULL; 416 418 time_t moddate; 417 419 char path[255]; … … 455 457 { 456 458 struct stat st; 459 FILE *fp = NULL; 460 int32_t readen = 0; 461 char separator[255]; 462 457 463 stat(filename, &st); 458 464 moddate = st.st_mtime; 465 memset(separator, 0, sizeof(separator)); 466 467 if(filen == 1 && cfg.http_prepend_embedded_css) // Prepend Embedded CSS 468 { 469 CSS = tpl_getUnparsedTpl("CSS", 1, ""); 470 snprintf(separator, sizeof(separator), "\n/* Beginn embedded CSS File: %s */\n", cfg.http_css); 471 } 472 459 473 // We need at least size 1 or keepalive gets problems on some browsers... 460 474 if(st.st_size > 0) 461 475 { 462 FILE *fp;463 int32_t readen;464 if((fp = fopen(filename, "r")) == NULL) { return; } 465 if(!cs_malloc(&allocated, st.st_size + 1))476 if((fp = fopen(filename, "r")) == NULL) 477 return; 478 479 if(!cs_malloc(&allocated, st.st_size + strlen(CSS) + strlen(separator) + 1)) 466 480 { 467 481 send_error500(f); … … 469 483 return; 470 484 } 471 if((readen = fread(allocated, 1, st.st_size, fp)) == st.st_size) 485 486 if((readen = fread(allocated + strlen(CSS) + strlen(separator), 1, st.st_size, fp)) == st.st_size) 472 487 { 473 allocated[readen ] = '\0';488 allocated[readen + strlen(CSS) + strlen(separator)] = '\0'; 474 489 } 490 475 491 fclose(fp); 476 492 } … … 478 494 if(filen == 1 && cfg.http_prepend_embedded_css) // Prepend Embedded CSS 479 495 { 480 char separator [255]; 481 snprintf(separator, 255, "\n/* Beginn embedded CSS File: %s */\n", cfg.http_css); 482 char *oldallocated = allocated; 483 CSS = tpl_getUnparsedTpl("CSS", 1, ""); 484 int32_t newsize = strlen(CSS) + strlen(separator) + 2; 485 if(oldallocated) { newsize += strlen(oldallocated) + 1; } 486 if(!cs_malloc(&allocated, newsize)) 496 if (CSS) 487 497 { 488 if(oldallocated) { NULLFREE(oldallocated); } 489 NULLFREE(CSS); 490 send_error500(f); 491 return; 498 memcpy(allocated, CSS, strlen(CSS)); 499 memcpy(allocated + strlen(CSS), separator, strlen(separator)); 500 allocated[readen + strlen(CSS) + strlen(separator)] = '\0'; 492 501 } 493 if (CSS){494 snprintf(allocated, newsize, "%s\n%s\n%s", CSS, separator, (oldallocated != NULL ? oldallocated : ""));495 }496 if(oldallocated) { NULLFREE(oldallocated); }497 502 } 498 503
Note:
See TracChangeset
for help on using the changeset viewer.