Skip to content

Commit

Permalink
Fix "out of bounds" error in ptz movements
Browse files Browse the repository at this point in the history
  • Loading branch information
roleoroleo committed Jul 20, 2024
1 parent 7cb7db0 commit 4c02041
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ptz_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,11 +547,11 @@ int ptz_relative_move()
} else {
if ((x != NULL) && (y != NULL)) {
dx = atof(x);
if ((dx > 360.0) || (dx < -360.0)) {
if ((dx > service_ctx.ptz_node.max_step_x) || (dx < -service_ctx.ptz_node.max_step_x)) {
ret = -5;
}
dy = atof(y);
if ((dy > 180.0) || (dy < -180.0)) {
if ((dy > service_ctx.ptz_node.max_step_y) || (dy < -service_ctx.ptz_node.max_step_y)) {
ret = -6;
} else {
sprintf(sys_command, service_ctx.ptz_node.jump_to_rel, dx, dy);
Expand Down Expand Up @@ -686,11 +686,11 @@ int ptz_absolute_move()
} else {
if ((x != NULL) && (y != NULL)) {
dx = atof(x);
if ((dx > 360.0) || (dx < 0.0)) {
if ((dx > service_ctx.ptz_node.max_step_x) || (dx < 0.0)) {
ret = -5;
}
dy = atof(y);
if ((dy > 180.0) || (dy < 0.0)) {
if ((dy > service_ctx.ptz_node.max_step_y) || (dy < 0.0)) {
ret = -6;
} else {
sprintf(sys_command, service_ctx.ptz_node.jump_to_abs, dx, dy);
Expand Down

0 comments on commit 4c02041

Please sign in to comment.