patch %s out of format strings received from phone

%s can obviously not work, as we have no access to the targets memory
space on the host PC.  I guess the programmers adding those log lines
have done so in error.  Let's replace %s with %p in the format string.
This commit is contained in:
Harald Welte 2017-01-08 13:45:54 +01:00
parent 5fa552cbd3
commit b8a70980b6
1 changed files with 6 additions and 0 deletions

View File

@ -100,6 +100,12 @@ static void diag_rx_ext_msg_f(struct diag_instance *di, struct msgb *msgb)
printf("MSG(%u|%u|%s:%u): ", osmo_load16le(&msg->subsys_id),
diag_ts_to_epoch(osmo_load64le(&msg->hdr.timestamp)),
file, osmo_load16le(&msg->line_nr));
/* replace all '%s' with '%p', as %s obviously doesn't work */
for (char *cur = fmt; cur && (cur < fmt + strlen(fmt)); cur = strstr(fmt, "%s")) {
cur[1] = 'p';
}
switch (num_args) {
case 0:
fputs(fmt, stdout);