- Timestamp:
- 06/27/18 18:01:48 (3 years ago)
- Branches:
- cachetimestamps, develop, master, rc-4.0.4, ringdecrementfix, ringperformance
- Children:
- 1ed69dc
- Parents:
- 35de364
- Location:
- lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_linux_common.c
rf9df20e r47d4f8c 87 87 sock = socket(PF_INET, SOCK_STREAM, 0); 88 88 memset(&ifr, 0, sizeof(struct ifreq)); 89 strncpy(ifr.ifr_name, libtrace->uridata, IF_NAMESIZE );89 strncpy(ifr.ifr_name, libtrace->uridata, IF_NAMESIZE - 1); 90 90 if (ioctl(sock, SIOCGIFHWADDR, &ifr) != 0) { 91 91 perror("Can't get HWADDR for interface"); -
lib/libtrace.h.in
r32ee9b2 r47d4f8c 277 277 typedef struct trace_err_t{ 278 278 int err_num; /**< error code */ 279 char problem[ 255]; /**< the format, uri etc that caused the error for reporting purposes */279 char problem[1024]; /**< the format, uri etc that caused the error for reporting purposes */ 280 280 } libtrace_err_t; 281 281 -
lib/trace.c
r32ee9b2 r47d4f8c 107 107 * will use our own one that does 108 108 */ 109 static void xstrncpy(char *dest, const char *src, size_t n) 110 { 111 strncpy(dest,src,n); 112 dest[n]='\0'; 109 static inline void xstrncpy(char *dest, const char *src, size_t n, 110 size_t destlen) 111 { 112 size_t slen = destlen - 1; 113 if (n < slen) { 114 slen = n; 115 } 116 strncpy(dest,src,slen); 117 dest[slen]='\0'; 113 118 } 114 119 … … 120 125 exit(EXIT_FAILURE); 121 126 } 122 xstrncpy(ret,src,n );127 xstrncpy(ret,src,n,n+1); 123 128 return ret; 124 129 } … … 371 376 372 377 if((uridata = strchr(uri,':')) == NULL) { 373 xstrncpy(scan, uri, strlen(uri) );378 xstrncpy(scan, uri, strlen(uri), URI_PROTO_LINE); 374 379 } else { 375 xstrncpy(scan,uri, (size_t)(uridata - uri) );380 xstrncpy(scan,uri, (size_t)(uridata - uri), URI_PROTO_LINE); 376 381 } 377 382
Note: See TracChangeset
for help on using the changeset viewer.