Changeset 107:4586e930769b in roaraudio
- Timestamp:
- 07/13/08 02:50:30 (16 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- roard
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/meta.c
r96 r107 39 39 } 40 40 41 if ( (c = malloc(strlen(val) )) == NULL ) {41 if ( (c = malloc(strlen(val)+1)) == NULL ) { 42 42 s->meta[i].type = ROAR_META_TYPE_NONE; 43 43 s->meta[i].key[0] = 0; … … 58 58 59 59 int stream_meta_get (int id, int type, char * name, char * val, size_t len) { 60 int i ;60 int i, vallen; 61 61 struct roar_stream_server * s = g_streams[id]; 62 62 … … 70 70 continue; 71 71 72 if ( strlen(s->meta[i].value) > (len - 1) ) 72 if ( (vallen = strlen(s->meta[i].value)) > (len - 1) ) { 73 ROAR_DBG("stream_meta_get(*): val too small: need %i have %i", vallen, len); 73 74 return -1; 75 } 74 76 75 strcpy(val, s->meta[i].value); 77 strncpy(val, s->meta[i].value, vallen); 78 val[vallen] = 0; 76 79 77 80 return 0; -
roard/req.c
r101 r107 203 203 int vallen; 204 204 int type; 205 char val[LIBROAR_BUFFER_MSGDATA- 2];205 char val[LIBROAR_BUFFER_MSGDATA-1]; 206 206 207 207 if ( mes->datalen != 2 ) … … 224 224 mes->data[1] = (unsigned char) vallen; 225 225 226 strncpy(&(mes->data[2]), val, vallen); 226 val[vallen] = 0; 227 228 strncpy(&(mes->data[2]), val, vallen+1); 227 229 228 230 return 0;
Note: See TracChangeset
for help on using the changeset viewer.